VB.Net and ADO

  • Thread starter Thread starter gpayne
  • Start date Start date
G

gpayne

Does anyone know how to connect to a database that has a
password using the ADODC control. I can do it all day
long on databases without a password but cannot get it to
connect with a database with a password. I add an ADODC
control to my form and set its properties to the DB and
it opens a dialog box asking for a provider strin.
Microsoft help has nothing about a provider string.
 
I haven't used ADODC in .NET, the preferred method is to use an
OleDbDataAdaptor with an OleDbConnection, but I'm guessing you're porting
legacy code over and have too much of an investment in ADODC to change.

A full connection string using OleDb to point to an Access mdb in .NET would
look something like:

"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet
OLEDB:Database Locking Mode=1;Data Source="H:\Test
Stuff\AccessSchemaNET\dxsAccessSchemaNET.mdb";Jet OLEDB:Engine
Type=5;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share
Deny None;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Global
Bulk Transactions=1"

There's a provider string buried in the middle of that:
Provider="Microsoft.Jet.OLEDB.4.0"

I don't know if this helps but it might be a start point.

David Straker
 
I'm not familiar with the ADODC control, but here's how a .NET
OleDbConnection connection string that includes a database password looks.

The part of this string that specifies the database password is "Jet
OLEDB:Database Password=somepassword;", not to be confused with
"Password=;", elsewhere in the connection string, which specifies the user
and group level security password.

Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet
OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=somepassword;Data
Source="C:\SomePath\SomeFile.MDB";Password=;Jet OLEDB:Engine Type=5;Jet
OLEDB:Global Bulk Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet
OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share
Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt
Database=False
 
Back
Top