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

Recommended Answers

All 3 Replies

Do you work on windows Vista?

And what antivirus software are you running?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.