Perry,
Application.Sta rtupPath gives you the location of the exe file. This is
where the database is assumed to be located if you don't say otherwise.
If your database is in a folder named Database that is a subfolder of the
folder where your exe file is located then you should be able to do this:
Data Source=Database \Database.mdb
Kerry Moorman
"Perry Langla" wrote:
Application.Sta rtupPath gives you the location of the exe file. This is
where the database is assumed to be located if you don't say otherwise.
If your database is in a folder named Database that is a subfolder of the
folder where your exe file is located then you should be able to do this:
Data Source=Database \Database.mdb
Kerry Moorman
"Perry Langla" wrote:
What I am trying to do is get the directory information of the executing
assembly and insert this information into the ConnectionStrin g. Here is an
example of what I have so far;
>
' I am using reflection to find the location of the exe file. This is
because the directory
'for the database is located in the same directory.
>
Dim Asm As System.Reflecti on.Assembly =
System.Reflecti on.Assembly.Get ExecutingAssemb ly
Dim strEXELoc As String
strEXELoc = Asm.Location
>
' I am now putting the information into the string.
>
Dim strTemp As String
strTemp = strEXELoc
strTemp = System.IO.Path. GetDirectoryNam e(strEXELoc)
>
Dim DatabaseInfo As String
DatabaseInfo = strTemp
>
>
'
'OleDbConnectio n1
'
Me.OleDbConnect ion1.Connection String = "Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""C:\Pro gram
Files\Company" & _
"\Program\Datab ase\Database.md b"";Jet OLED" & _
"B:Engine Type=5;Provider =""Microsoft.Je t.OLEDB.4.0"";J et
OLEDB:System database=;Je" & _
"t OLEDB:SFP=False ;Jet OLEDB:Global Bulk Transactions=1; Mode=Share
Deny None;Jet " & _
"OLEDB:New Database Password=;Jet OLEDB:Create System
Database=False; Jet OLEDB:Do" & _
"n't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica
Repair=False;" & _
"User ID=Admin;Jet OLEDB:Encrypt Database=False"
>
>
I am trying to get the Data Source to read Data Source=""Defaul t
Drive:\Executin gAssembly Location\Databa se\Database.mdb ""
>
>
Please help. I think I am on the right track.
>
Thanks Perry
>
assembly and insert this information into the ConnectionStrin g. Here is an
example of what I have so far;
>
' I am using reflection to find the location of the exe file. This is
because the directory
'for the database is located in the same directory.
>
Dim Asm As System.Reflecti on.Assembly =
System.Reflecti on.Assembly.Get ExecutingAssemb ly
Dim strEXELoc As String
strEXELoc = Asm.Location
>
' I am now putting the information into the string.
>
Dim strTemp As String
strTemp = strEXELoc
strTemp = System.IO.Path. GetDirectoryNam e(strEXELoc)
>
Dim DatabaseInfo As String
DatabaseInfo = strTemp
>
>
'
'OleDbConnectio n1
'
Me.OleDbConnect ion1.Connection String = "Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""C:\Pro gram
Files\Company" & _
"\Program\Datab ase\Database.md b"";Jet OLED" & _
"B:Engine Type=5;Provider =""Microsoft.Je t.OLEDB.4.0"";J et
OLEDB:System database=;Je" & _
"t OLEDB:SFP=False ;Jet OLEDB:Global Bulk Transactions=1; Mode=Share
Deny None;Jet " & _
"OLEDB:New Database Password=;Jet OLEDB:Create System
Database=False; Jet OLEDB:Do" & _
"n't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica
Repair=False;" & _
"User ID=Admin;Jet OLEDB:Encrypt Database=False"
>
>
I am trying to get the Data Source to read Data Source=""Defaul t
Drive:\Executin gAssembly Location\Databa se\Database.mdb ""
>
>
Please help. I think I am on the right track.
>
Thanks Perry
>
Comment