I have a Windows 2008 R2 x64 enterprise edition + SQL Server 2008 R2 datacenter edition
from its local computer I can make connection to the SQL server with sqlClient in C#
and here is my connection string looks like :
using (sqlconnection cn = new sqlconnection("Data Source=myServerIPAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"))
{
cn.open(); //I'll get error here from remote
using (sqlcommand cmd = new sqlcommand("sql",cn))
{
//some code here
}
}
but with exact above code from a remote computer I’ll get this error :
Timeout expired. The timeout period
elapsed prior to completion of the
operation or the server is not
responding.
but when I change above code to oledb everything works fine.
respectively the connection string for oledb gonna change and this is my oledb connection string :
Provider=SQLOLEDB;Data
Source=myserverIP;Password=password;User
ID=sa;Initial Catalog=catalog
note: I’ve tried this also but no difference.
Hai,
please set Connection Timeout attribute of your connection string .