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