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.

SqlConnection conn;
        public  static SqlConnection getConnection(){

            SqlConnection con=new SqlConnection("Data Source=Test_PP;Initial Catalog=Test_T;User ID=test;Password=test");
            
            return con;
        }

        public static SqlDataReader getdatareader(string str){

            
            SqlConnection conn = dbEngin.getConnection();
            //logclass.WriteTOLOG(DateTime.Now.ToString() + '\t' + "Establish the  Sql Database connectivity");
            SqlConnection.ClearPool(conn);

            conn.Close();
           //logclass.WriteTOLOG(DateTime.Now .ToString()+ '\t' + "Close the SQL connectivity");
           conn.Open();
          // logclass.WriteTOLOG(DateTime.Now.ToString()+ '\t' + "Open the SQL connectivity");
           SqlCommand command = new SqlCommand(str, conn);
          // logclass.WriteTOLOG(DateTime.Now.ToString() + '\t'+ "Executing the SQL query"+str);
            return command.ExecuteReader();
           
        }

Please help me solve this problem

Edited 7 Years Ago by Tank50: n/a

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

This article has been dead for over six months. Start a new discussion instead.