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 (cant 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,
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 (cant 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,