So I've created a Windows based application in C# that uses data from our databases on a service provider (crystaltech). The application has been deployed and has been working great on all our computers and all our clients computers, except for one... When every they try to login/communicate with the database it returns the following error:
I've searched google for hours and tried just about every variation of a connection string using both sql and oledb connections. The current connection string causing this error is:
and
I've also used:
Everyone else connects fine and the software runs great, except this one user. I've also had them add the port in windows firewall in network connection settings, and nothing.
Here is the exact function causing the error:
The user is running Windows XP 5.1, and like I said only one user is getting this error. Thanks for you time.
Derek
Code:
System.Data.SqlClient.SqlException: 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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at ColeyClientSystem.Utils.DataManager.ExecuteScalar(String query) at ColeyClientSystem.Login.AttemptLogin()
Code:
Data Source=xxx.xxx.xxx.xxx,1433;Network Library=DBMSSOCN;Initial Catalog=xxx;User ID=xxx;Password=xxx
Code:
Provider=SQLOLEDB;Data Source=xxx.xxx.xxx.xxx,1433;Persist Security Info=True;Password=xxx;User ID=xxx;Initial Catalog=xxx
Code:
Data Source=xxx.webcontrolcenter.com;Type System Version=SQL Server 2000;Integrated Security=False;Persist Security Info=True;Password=xxx;User ID=xxx;Initial Catalog=xxx
Here is the exact function causing the error:
Code:
public static String ExecuteScalar(string query)
{
string connectionString = "Data Source=xxx.xxx.xxx.xxx,1433;Network Library=DBMSSOCN;Initial Catalog=xxx;User ID=xxx;Password=xxx";
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
try
{
SqlCommand sqlcmd = new SqlCommand(query, connection);
return sqlcmd.ExecuteScalar().ToString();
}
catch
{
return "";
}
finally
{
if (connection.State == ConnectionState.Open)
connection.Close();
}
}
Derek
Comment