Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tuzojazz
Starting Member
7 Posts |
Posted - 2006-05-02 : 17:12:40
|
| Hi:I'm trying to connect to a data base of "sql server 2005 enterprise" named BCR.The server name is "server1"I'm using Windows Authentication to connect to serverThe operating system is Windows Server 2003 Enterprise Edition Service Pack 1When I run the aspx I get this error at line 21---------------------------------------------------------------System.Data.OleDb.OleDbException: Invalid authorization specification Invalid connection string attribute at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) at System.Data.OleDb.OleDbConnection.InitializeProvider() at System.Data.OleDb.OleDbConnection.Open() at ASP.pruebaLeeSqlServer_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in Z:\Digital\pruebaLeeSqlServer.aspx:line 21--------------------------------------------------------------- This is my code:------------------------------------------------------------------Dim str2 As String = "Provider=SQLNCLI; Server = server1; Database = BCR"Dim cnn2 As OleDbConnection = New OleDbConnection(str2)Dim cmd2 As New OleDbCommand()Dim drd2 As OleDbDataReaderTry cnn2.Open() cmd2.Connection = cnn2''''''''''''''''''''''''''''''''''''''''''''''''''''line 21 cmd2.CommandText ="SELECT LastName FROM Employees" drd2 = cmd2.ExecuteReader Do While drd2.Read %> <%=drd2.GetString(0)%><br> <% Loop drd2.Close()Catch exc1 As Exception %> <%=exc1.ToString()%> <%Finally cnn2.Close() End Try------------------------------------------------------------------What could be wrong?Do I need enable permission for asp.net in sql server?how I can do it?Thanks!! |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-05-02 : 20:58:09
|
| your connection string is incorrect, what is the value of ccn2.activestatus? (or some parameter that will check if ccn2 is open = successful connection)--------------------keeping it simple... |
 |
|
|
tuzojazz
Starting Member
7 Posts |
Posted - 2006-05-03 : 19:43:46
|
| thanks jenbut to solve the problem I just had to use System.Data.SqlClient namespacesee you! |
 |
|
|
|
|
|