Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 8th, 2005, 03:31 AM
Shaitan00 Shaitan00 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 29 Shaitan00 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 50 sec
Reputation Power: 0
Question Unable to connect to SQL Database

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,

Reply With Quote
  #2  
Old February 8th, 2005, 04:04 AM
Tonny-Soeroso Tonny-Soeroso is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 36 Tonny-Soeroso User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 56 m 27 sec
Reputation Power: 0
Use try catch to get the error message.Hope this can help.


Rgds,


Tonny Soeroso

Reply With Quote
  #3  
Old February 8th, 2005, 02:05 PM
Shaitan00 Shaitan00 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 29 Shaitan00 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 50 sec
Reputation Power: 0
Question

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?

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Unable to connect to SQL Database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT