943,547 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 553
  • C# RSS
Sep 18th, 2009
0

SQl connectivity Problem

Expand Post »
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.



C# Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 12
Solved Threads: 1
Junior Poster
Tank50 is offline Offline
124 posts
since Aug 2008
Sep 18th, 2009
0

Re: SQl connectivity Problem

Do you work on windows Vista?
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Sep 18th, 2009
0

Re: SQl connectivity Problem

And what antivirus software are you running?
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Sep 20th, 2009
0

Re: SQl connectivity Problem

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
Reputation Points: 12
Solved Threads: 1
Junior Poster
Tank50 is offline Offline
124 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Add Items to Listview
Next Thread in C# Forum Timeline: DateTime.. out_of_range





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC