SQl connectivity Problem

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 94
Reputation: Tank50 is an unknown quantity at this point 
Solved Threads: 1
Tank50's Avatar
Tank50 Tank50 is offline Offline
Junior Poster in Training

SQl connectivity Problem

 
0
  #1
Sep 18th, 2009
Hi

In my Project I used to connect to sql server2000,which is not in local computer.I use visual studio 2005 to develop the windows application.Once I run the apllication it gave me error message ,below I mention the error meassage I got

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections

* But sometime once I run the application it never gave me above error.Below I write sql connection part.



  1. SqlConnection conn;
  2. public static SqlConnection getConnection(){
  3.  
  4. SqlConnection con=new SqlConnection("Data Source=Test_PP;Initial Catalog=Test_T;User ID=test;Password=test");
  5.  
  6. return con;
  7. }
  8.  
  9. public static SqlDataReader getdatareader(string str){
  10.  
  11.  
  12. SqlConnection conn = dbEngin.getConnection();
  13. //logclass.WriteTOLOG(DateTime.Now.ToString() + '\t' + "Establish the Sql Database connectivity");
  14. SqlConnection.ClearPool(conn);
  15.  
  16. conn.Close();
  17. //logclass.WriteTOLOG(DateTime.Now .ToString()+ '\t' + "Close the SQL connectivity");
  18. conn.Open();
  19. // logclass.WriteTOLOG(DateTime.Now.ToString()+ '\t' + "Open the SQL connectivity");
  20. SqlCommand command = new SqlCommand(str, conn);
  21. // logclass.WriteTOLOG(DateTime.Now.ToString() + '\t'+ "Executing the SQL query"+str);
  22. return command.ExecuteReader();
  23.  
  24. }

Please help me solve this problem
Last edited by Tank50; Sep 18th, 2009 at 10:36 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: SQl connectivity Problem

 
0
  #2
Sep 18th, 2009
Do you work on windows Vista?
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: SQl connectivity Problem

 
0
  #3
Sep 18th, 2009
And what antivirus software are you running?
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 94
Reputation: Tank50 is an unknown quantity at this point 
Solved Threads: 1
Tank50's Avatar
Tank50 Tank50 is offline Offline
Junior Poster in Training

Re: SQl connectivity Problem

 
0
  #4
Sep 20th, 2009
Hi

No iam using Winodws Xp I dont what is service pack,I think it may be service pack3,but sql server 2000 install in windows server 2003.And  anti virus is Kaspersky Anti-Virus 6.0

Thanks
Tank50
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC