C
Chris Thunell
I have a program where i connect to an access database and get some
information out of it. I'm using the oledb.3.51 version, my computer
doesn't seem to have the 4.0 version, but the computer that is trying to run
it only have the 4.0 version. So as you will see with the code below, i
first try to open the 4.0 version... if that doesn't work, do the 3.51
version. When i run the program from my computer... the 4.0 fails and it
goes to the 3.51 and it works fine. On his computer NEITHER version works.
Is there anyway to either include my oledb version in the program, OR get
the version of oledb on the computer running that program.. and use that in
the connection string?
Thanks!
Chris Thunell
(e-mail address removed)
Code (Please excuse the numerous rem out statements... i've been trying all
kinds of combinations):
Dim myprovider As String
Dim myAccessConn As String
'myAccessConn = "Jet OLEDB:Registry Path=;User ID=Admin;Jet OLEDBatabase
Password=;Provider='Microsoft.Jet.OLEDB.3.51';Persist Security
Info=False;Jet OLEDB:System database=;Jet OLEDB:Global Partial Bulk
Ops=2;Mode=Share Deny None;Extended
Properties=';COUNTRY=0;CP=1252;LANGID=0x0409';Data Source='"
'myAccessConn = "Jet OLEDB:Registry Path=;User ID=Admin;Jet OLEDBatabase
Password=;Provider='Microsoft.Jet.OLEDB.4.0';Persist Security Info=False;Jet
OLEDB:System database=;Jet OLEDB:Global Partial Bulk Ops=2;Mode=Share Deny
None;Extended Properties=';COUNTRY=0;CP=1252;LANGID=0x0409';Data Source='"
myAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='"
myAccessConn = myAccessConn & Trim(lblFileLocation.Text)
myAccessConn = myAccessConn & "'"
Me.OleDbConnection1.ConnectionString = myAccessConn
'open the database
Try
Me.OleDbDataAdapter1.Fill(Me.DataSet11.BILL_OF_MATERIALS)
Catch ex As Exception
MessageBox.Show("4.0 didn't work - Trying 3.51")
myAccessConn = ""
'myAccessConn = "Jet OLEDB:Registry Path=;User ID=Admin;Jet OLEDBatabase
Password=;Provider='Microsoft.Jet.OLEDB.3.51';Persist Security
Info=False;Jet OLEDB:System database=;Jet OLEDB:Global Partial Bulk
Ops=2;Mode=Share Deny None;Extended
Properties=';COUNTRY=0;CP=1252;LANGID=0x0409';Data Source='"
myAccessConn = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source='"
myAccessConn = myAccessConn & Trim(lblFileLocation.Text)
myAccessConn = myAccessConn & "'"
Me.OleDbConnection1.ConnectionString = myAccessConn
Me.OleDbDataAdapter1.Fill(Me.DataSet11.BILL_OF_MATERIALS)
End Try
information out of it. I'm using the oledb.3.51 version, my computer
doesn't seem to have the 4.0 version, but the computer that is trying to run
it only have the 4.0 version. So as you will see with the code below, i
first try to open the 4.0 version... if that doesn't work, do the 3.51
version. When i run the program from my computer... the 4.0 fails and it
goes to the 3.51 and it works fine. On his computer NEITHER version works.
Is there anyway to either include my oledb version in the program, OR get
the version of oledb on the computer running that program.. and use that in
the connection string?
Thanks!
Chris Thunell
(e-mail address removed)
Code (Please excuse the numerous rem out statements... i've been trying all
kinds of combinations):
Dim myprovider As String
Dim myAccessConn As String
'myAccessConn = "Jet OLEDB:Registry Path=;User ID=Admin;Jet OLEDBatabase
Password=;Provider='Microsoft.Jet.OLEDB.3.51';Persist Security
Info=False;Jet OLEDB:System database=;Jet OLEDB:Global Partial Bulk
Ops=2;Mode=Share Deny None;Extended
Properties=';COUNTRY=0;CP=1252;LANGID=0x0409';Data Source='"
'myAccessConn = "Jet OLEDB:Registry Path=;User ID=Admin;Jet OLEDBatabase
Password=;Provider='Microsoft.Jet.OLEDB.4.0';Persist Security Info=False;Jet
OLEDB:System database=;Jet OLEDB:Global Partial Bulk Ops=2;Mode=Share Deny
None;Extended Properties=';COUNTRY=0;CP=1252;LANGID=0x0409';Data Source='"
myAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='"
myAccessConn = myAccessConn & Trim(lblFileLocation.Text)
myAccessConn = myAccessConn & "'"
Me.OleDbConnection1.ConnectionString = myAccessConn
'open the database
Try
Me.OleDbDataAdapter1.Fill(Me.DataSet11.BILL_OF_MATERIALS)
Catch ex As Exception
MessageBox.Show("4.0 didn't work - Trying 3.51")
myAccessConn = ""
'myAccessConn = "Jet OLEDB:Registry Path=;User ID=Admin;Jet OLEDBatabase
Password=;Provider='Microsoft.Jet.OLEDB.3.51';Persist Security
Info=False;Jet OLEDB:System database=;Jet OLEDB:Global Partial Bulk
Ops=2;Mode=Share Deny None;Extended
Properties=';COUNTRY=0;CP=1252;LANGID=0x0409';Data Source='"
myAccessConn = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source='"
myAccessConn = myAccessConn & Trim(lblFileLocation.Text)
myAccessConn = myAccessConn & "'"
Me.OleDbConnection1.ConnectionString = myAccessConn
Me.OleDbDataAdapter1.Fill(Me.DataSet11.BILL_OF_MATERIALS)
End Try