2

I recently installed SQL Server Management Studio (which also installed SQL Server 2016 to my local machine), and now am unable to connect to SQL Server from applications on my machine. It will come up with the error message below:

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied

At this point, should I just uninstall SQL Server Management Studio/SQL Server, or is there an easy way to resolve this issue without needing to do so?

Here is the code I am attempting to execute which worked before installing SQL Server and SSMS:

string connectionstring = ConfigurationManager.ConnectionStrings["B2BConnString"].ToString();

OleDbConnection conn = new OleDbConnection("Provider=SQLOLEDB;"+connectionstring);
conn.Open();

string strSQL = "select [aliasname], [apikey], [password], [sharedsecret], [url], [isTest], [lastid] from ShopifyWSSetup as s Inner Join Clients as c on s.cno = c.cno where isactive = 1 and aliasname = '"+aliasname+"';";
OleDbCommand comm = new OleDbCommand(strSQL, conn);

OleDbDataReader reader = comm.ExecuteReader();
if (reader.HasRows)
{
    while (reader.Read())
    {
        apikey = reader.GetString(1);
        password = reader.GetString(2);
        sharedsecret = reader.GetString(3);
        url = reader.GetString(4);
        isTest = reader.GetBoolean(5);
        if (!reader.IsDBNull(6))
        {
            lastid = reader.GetString(6);
        }
    }
}

conn.Close();
conn.Dispose();
reader.Close();

Here is the connection string being used:

<connectionStrings>
    <add 
        name="ExampleConnString" 
        connectionString="Data Source=10.0.1.111;Initial Catalog=Example;User ID=Example;Password=examplePW;Connect Timeout=30"
        providerName="System.Data.SqlClient"/>
</connectionStrings>

Update:

I uninstalled SQL Server 2016, so only 2008 is on the machine now. The protocol is set to port 1433, enabled, keep alive 30000, keep alive internal 1000. Named pipes - default pipe: sql\query, enabled. Shared memory enabled.

1
  • 1
    What are the instances listed in Configuration Manager? Also, why does your connection string say Provider=System.Data.SqlClient but then your code prefixes it with Provider=SQLOLEDB? Aug 12, 2015 at 0:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.