i want to make a test connection module for my application which test if the server is found on a particular IP with user name and password
some of our servers don't have password so it is just a user name
when i call the method to check the database connection this exception is released
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
i don't know why it contain SQL Server 2005 while i'm connecting to SQL Server 2000
and why it fails when i enters a connection string with no password although it connects on the query analyzer
example of the connection string
"packet size=4096;user id=sa;data source=xxx.xxx.xxx.xxx;persist security info=True;password=;initial catalog=DebitCardIssuance"
the function i'm using to test the connection
SqlConnection conn = new SqlConnection(connectionString);
try
{
conn.Open();
return true;
}catch(Exception e)
{
return false;
}
please advice