Ole DB Connection string

Connectivity

Ole DB Connection string

We are (attempting) to use the Ole Db provider for .NET. I am able to connect to the database, but cannot figure out the correct way to set the default database. What is the connection string property for setting the Default Database?
2 REPLIES

Re: Ole DB Connection string

It looks like I found the answer - using the Extended properties appears to do the trick. Here is an example of the connection string that seems to work:

Provider=TDOLEDB.1;Data Source=xxx.xxx.xxx;Persist Security Info=True;User ID=user;Password=12345;Extended Properties=Default Database=DataBaseName;Session Mode=ANSI

Now, a new problem/question: when adding parameters to a command, what prefix (if any) should be used before the parameter name? If I remember correctly, ODBC likes a ":", Sql server uses a "@". Have any ideas on how to properly prefix a named parameter using the OLE DB Provider?

thanks in advance,

Sancerre

Re: Ole DB Connection string

We have found the answer to the last question as well. To help any of you that may need to use parameters with a command object, then this is how we got it to work: Don't use named parameters, instead use a "?" as the name for each parameter. Of course, you had better make sure that your params are added and used in the correct order.

If anybody out there has managed to use named parameters with OLE DB, then please let us know the trick!

-- Sancerre