connection string probs

hi All,

I have the following connection string:

Driver={SQL Server};Server=myserver;initial catalog=AccessLayer;UID=myuser;password=mypassword;integrated security=SSPI;persist security info=False;

my connection object is declared :

Private m_objConnect As IDbConnection

and I instansiate it with :

m_objConnect = New SqlClient.SqlConnection

When I set

m_objConnect.ConnectionString() = to the string above, I receive an exception saying that Driver isn't supported?

what should I be using to make the connection?
[599 byte] By [Bill Crawley] at [2007-11-19 14:01:54]
# 1 Re: connection string probs
Your connectionstring is for an ODBC connection and your confusing it by passing authentication credientials and designating Windows Integrated Security. You need to choose one or the other but not both.
'Integrated security
"Driver={SQL Server};Server=MyServer;Database=AccessLayer;Trusted_Connection=yes;"

'SQL authentication
"Driver={SQL Server};Server=MyServer;Database=AccessLayer;Uid=myuser;Pwd=mypassword;"
RobDog888 at 2007-11-10 3:16:08 >
# 2 Re: connection string probs
You're using a connection string for an OdbcConnection with an SqlConnection object. Take a look at www.connectionstrings.com and see what the connection string for an SqlConnection should look like. Also, is there a particular reason you have declared your connection variable as an IDbConnection? Are you intending that it can refer to other types of connection objects as well? If not then declare it as the most specific type you can, which would be SqlConnection.
jmcilhinney at 2007-11-10 3:17:06 >
# 3 Re: connection string probs
Thanks,

It cant open the connection now, but that's another issue. I think our server might need a HotFix.
Bill Crawley at 2007-11-10 3:18:13 >