Question Connection String for VB 2010 Express

tvb2727

Member
Joined
Jul 19, 2012
Messages
8
Programming Experience
1-3
What is the connection string for SQL server 2008 and Visual Basic 2010 Express.

I have this, but need to somehow put the provider in there?

"Data Source=xxxxx;Initial Catalog=xxxxx;User ID=xxxxx;Password=xxxxx;Integrated Security=false"
 
If you use the native MSSQL client you don't need to. And why not stay in the original thread you created?

EDIT: My mistake, I thought you were the same person to whom I answered a very similar question a couple of hours ago, but apparently you are not.
 
Last edited:
Well I ran my code and tried to connect to the SQL server and it gave me an error saying I needed the provider in there. I can paste the error later tonight. I'm trying to move a application already written from ACCESS DB to SQL Server.
 
Are you using the native SQL client ODBC driver, or OleDb?

Not sure? I thought it would be an SQL connection. This is an example of what I do on my web site using my sql server:


Dim SQLcmd = New Data.SqlClient.SqlCommand
SQLcmd = New Data.SqlClient.SqlCommand(sql_str, mainconnection)

Do : While SQLdtr.Read()

Loop While SQLdtr.NextResult : mainconnection.Close()
 
For connection strings I usually use a UDL file. Rename a txt file to .udl and then open it. Use the gui to make your connection. Once done open the file in notepad and your connection string is there.
 
Are you using the native SQL client ODBC driver, or OleDb?

It would be OleDb

Here is the error I have now:

System.ArgumentException: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.


at System.Data.OleDb.OleDbConnectionString.ValidateProvider(String progid)


at System.Data.OleDb.OleDbConnectionString.ValidateConnectionString(String connectionString)


at System.Data.OleDb.OleDbConnectionString..ctor(String connectionString, Boolean validate)


at System.Data.OleDb.OleDbConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)


at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)


at System.Data.OleDb.OleDbConnection.ConnectionString_Set(DbConnectionPoolKey key)


at System.Data.OleDb.OleDbConnection.set_ConnectionString(String value)
 
Back
Top