T
Tory Eneboe
Hi,
I'm trying to open a connection to a SQL Server DB in C# (so that I can
later execute a stored procedure). The code I have included below produces
the following exception when "connection.Open()" is executed:
Unknown ProviderConnection string is not valid
In reading some of the other postings, it sounded like I should not have to
specify a "Provider" if accessing a SQL Server DB using ADO??? Does anyone
know how to fix this problem? I have launched Query Analyzer and verified
that the server, uid, pwd, and database are indeed correct. Also, I change
the SqlConnection string to point to a DB local to my development machine,
and it then worked fine.
By the way, I am using Widbey. However, our group does have (pre-Widbey) C#
code that is identical to the code show below, and that accesses the exact
same DB. That code works fine.
I'm not sure where to go from here, so any ideas would be appreciated.
Tory.
try
{
SqlConnection connection = new SqlConnection
("server=myserver.intel.com;uid=tory;pwd=example;database=Test");
connection.Open();
}
finally
{
if (connection.State == ConnectionState.Open)
connection.Close();
}
I'm trying to open a connection to a SQL Server DB in C# (so that I can
later execute a stored procedure). The code I have included below produces
the following exception when "connection.Open()" is executed:
Unknown ProviderConnection string is not valid
In reading some of the other postings, it sounded like I should not have to
specify a "Provider" if accessing a SQL Server DB using ADO??? Does anyone
know how to fix this problem? I have launched Query Analyzer and verified
that the server, uid, pwd, and database are indeed correct. Also, I change
the SqlConnection string to point to a DB local to my development machine,
and it then worked fine.
By the way, I am using Widbey. However, our group does have (pre-Widbey) C#
code that is identical to the code show below, and that accesses the exact
same DB. That code works fine.
I'm not sure where to go from here, so any ideas would be appreciated.
Tory.
try
{
SqlConnection connection = new SqlConnection
("server=myserver.intel.com;uid=tory;pwd=example;database=Test");
connection.Open();
}
finally
{
if (connection.State == ConnectionState.Open)
connection.Close();
}