|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am writing an ASP.NET web application that has to interface with an SQL Database (SQL Desktop Server, the one that comes with Visual Studios.NET 2003)
When I try to perform a SELECT on my DB I get the following error: Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied. Line 54: sqlDA.Fill(ds); I was thinking it was probably my Connection String that was incorrect (I use very similar code in Windows Applications at work and it it okay so only different factor is my localhost SQL Desktop Server) and I am currently logged on as admin on my XP-SP2 box This is what I am currently using: string strConnection = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Term;Data Source=(localhost);Packet Size=4096;Workstation ID=MYPC" Where [TERM] is the name of the TABLE and MYPC is my computers machine name. C# CODE: string strQuery = "Select * from [Term]"; m_SqlConnection = new SqlConnection(); m_SqlConnection.ConnectionString = strConnection; M_SqlConnection.Open(); System.Data.SqlClient.SqlDataAdapter sqlDA = new System.Data.SqlClient.SqlDataAdapter(strQuery, m_SqlConnection); System.Data.DataSet ds = new System.Data.DataSet(); sqlDA.Fill(ds); Is this incorrect? Is there a way to test the database connection manually (can't debug in ASP.NET)? Can oSQL help to troubleshoot? Am I going about this the wrong way for Web applications? (difference with normal Windows applications?) Any help would be appreciated. Thanks, |
|
#2
|
|||
|
|||
|
Use try catch to get the error message.Hope this can help.
Rgds, Tonny Soeroso |
|
#3
|
|||
|
|||
|
Can you provide an example of how I could use throw/catch to help in this situation?
Also I think it may be because the user (running ASP program) may not have access to the DB (possible?) Any clue how to fix that in Windows XP SP2? |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Unable to connect to SQL Database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|