inputting a database path/file and how to use connection in 2nd fo

G

Guest

I set up an OLEDB connection, adapter, and dataset on my opening form.
I want to input the Data Source and replace the DS supplied at design time
with a string variable (I will probably use an OpenFileDialog). Where do I
put the file dialog ? Another question, how do I make this
connection/adapter/DS available on my other forms ? Do I have to close the
connection and reopen it as I enter each form ? MANY THANKS for any help.

The way things are right now is as follows:

In #Region " Windows Form Designer generated code "
The following is generated:

Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""C:\Documents and Settings\bgb\My
Documents\Visual Stu" & _
"dio Projects\SourceKeeper\SourceKeeper\bin\CodeKeeper.mdb"";Jet
OLEDB:Engine Type" & _
"=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
database=;Jet OLEDB:SFP=F" & _
"alse;persist security info=False;Extended Properties=;Mode=Share
Deny None;Jet O" & _
"LEDB: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;U" & _
"ser ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
 
C

Cor Ligthert

Harry,

You can set everywhere

\\
me.oledbconnection1.connectionstring and than the string.
//
This is mostly enough as connection string
\\
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
" Data Source=" & FilePath & "User Id=admin;Password=;")
//
Don't remove the by the designer created one, otherwise you can come in
trouble by updates from designer parts by you.

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top