Connection String Dramas with JET and Directory GetCurrentDirectory

D

Daren Hawes

Hi I am using the Visual Studio connection string. See below

'
'OleDbConnection
'
Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data
Source=""D:\Clients\ABC\Air Train" & _
"
(Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb
"";Passw" & _
"ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=""Micr" & _
"osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;Extended Pro" & _
"perties=;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:Com" & _
"pact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt
Database=False" & _
""

I am having troubles refrencing this Database once deployed. IE The
path may be wrong.

I then tried to use the one below. But VS hates me doing this and
changes the code or deletes the Connection all together!

Dim ApplicationPath = Directory GetCurrentDirectory

Me.OleDbConnection.ConnectionString= "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""" &
ApplicationPath & "" & _
"\ATNotifier.mdb"";Passw" & _
"ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=""Micr" & _
"osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;Extended Pro" & _
"perties=;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:Com" & _
"pact Without Replica Repair=False;User ID=Admin;Jet
OLEDB:Encrypt Database=False" & _
""

Does anyone have any recommendations!!

Thx Daren
 
P

Paul Clement

¤ Hi I am using the Visual Studio connection string. See below
¤
¤ '
¤ 'OleDbConnection
¤ '
¤ Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk
¤ Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
¤ "ocking Mode=1;Jet OLEDB:Database Password=;Data
¤ Source=""D:\Clients\ABC\Air Train" & _
¤ "
¤ (Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb
¤ "";Passw" & _
¤ "ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
¤ Transactions=1;Provider=""Micr" & _
¤ "osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
¤ OLEDB:SFP=False;Extended Pro" & _
¤ "perties=;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:Com" & _
¤ "pact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt
¤ Database=False" & _
¤ ""
¤
¤ I am having troubles refrencing this Database once deployed. IE The
¤ path may be wrong.
¤
¤ I then tried to use the one below. But VS hates me doing this and
¤ changes the code or deletes the Connection all together!
¤
¤ Dim ApplicationPath = Directory GetCurrentDirectory
¤
¤ Me.OleDbConnection.ConnectionString= "Jet OLEDB:Global Partial Bulk
¤ Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
¤ "ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""" &
¤ ApplicationPath & "" & _
¤ "\ATNotifier.mdb"";Passw" & _
¤ "ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
¤ Transactions=1;Provider=""Micr" & _
¤ "osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
¤ OLEDB:SFP=False;Extended Pro" & _
¤ "perties=;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:Com" & _
¤ "pact Without Replica Repair=False;User ID=Admin;Jet
¤ OLEDB:Encrypt Database=False" & _
¤ ""
¤

You may want to junk most of the connection string parameters. Unfortunately, the wizard
unnecessarily adds a number of parameters, with no or default values. This can make troubleshooting
connection string problems rather difficult.

Try changing the ConnectionString property and use a minimal number of parameters:

OleDbConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ApplicationPath & "\ATNotifier.mdb;" & _
"Jet OLEDB:Engine Type=5"


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
D

Daren Hawes

Yeah I tried this, but VS hates me changing the code in the "Code
Created By Visual Studio" section and removes the connection all
together?

Any work around in VB?

Thx

-----Original Message-----
From: Paul Clement [mailto:[email protected]]
Posted At: Thursday, 9 December 2004 12:19 AM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Connection String Dramas with JET and Directory
GetCurrentDirectory
Subject: Re: Connection String Dramas with JET and Directory
GetCurrentDirectory


On Wed, 8 Dec 2004 14:23:49 +1000, "Daren Hawes"

¤ Hi I am using the Visual Studio connection string. See below ¤ ¤ '
¤ 'OleDbConnection
¤ '
¤ Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk ¤
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _ ¤ "ocking
Mode=1;Jet OLEDB:Database Password=;Data ¤ Source=""D:\Clients\ABC\Air
Train" & _ ¤ "
¤
(Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb
¤ "";Passw" & _
¤ "ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk ¤
Transactions=1;Provider=""Micr" & _ ¤ "osoft.Jet.OLEDB.4.0"";Jet
OLEDB:System database=;Jet ¤ OLEDB:SFP=False;Extended Pro" & _ ¤
"perties=;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:Com" & _ ¤ "pact Without Replica
Repair=False;User ID=Admin;Jet OLEDB:Encrypt ¤ Database=False" & _ ¤ ""
¤
¤ I am having troubles refrencing this Database once deployed. IE The ¤
path may be wrong.
¤
¤ I then tried to use the one below. But VS hates me doing this and ¤
changes the code or deletes the Connection all together!
¤
¤ Dim ApplicationPath = Directory GetCurrentDirectory ¤ ¤
Me.OleDbConnection.ConnectionString= "Jet OLEDB:Global Partial Bulk ¤
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
¤ "ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""" &
¤ ApplicationPath & "" & _
¤ "\ATNotifier.mdb"";Passw" & _
¤ "ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
¤ Transactions=1;Provider=""Micr" & _
¤ "osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
¤ OLEDB:SFP=False;Extended Pro" & _
¤ "perties=;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:Com" & _
¤ "pact Without Replica Repair=False;User ID=Admin;Jet
¤ OLEDB:Encrypt Database=False" & _
¤ ""
¤

You may want to junk most of the connection string parameters.
Unfortunately, the wizard unnecessarily adds a number of parameters,
with no or default values. This can make troubleshooting connection
string problems rather difficult.

Try changing the ConnectionString property and use a minimal number of
parameters:

OleDbConnection.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ApplicationPath &
"\ATNotifier.mdb;" & _
"Jet OLEDB:Engine Type=5"


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
P

Paul Clement

¤ Yeah I tried this, but VS hates me changing the code in the "Code
¤ Created By Visual Studio" section and removes the connection all
¤ together?
¤
¤ Any work around in VB?

Yes, create your ADO.NET objects using code instead of the Server Explorer.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

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