oledb problem in vb.net

Discussion in 'Microsoft Dot NET' started by Chris Thunell, Sep 20, 2004.

  1. 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


    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 OLEDB:Database
    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 OLEDB:Database
    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 OLEDB:Database
    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
     
    Chris Thunell, Sep 20, 2004
    #1
    1. Advertisements

  2. Chris Thunell

    Antonio Guest

    Hello Chris,

    I need a little more information on this one... can you replace you generic Exception with an oledbexception, and post it here?

    > 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
    >
    > 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
    > OLEDB:Database 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
    > OLEDB:Database 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
    > OLEDB:Database 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
    >
     
    Antonio, Sep 21, 2004
    #2
    1. Advertisements

  3. Chris Thunell

    Cor Ligthert Guest

    Double post (Re: oledb problem in vb.net)

    Just to make others aware not to open two messages and investigate them.
     
    Cor Ligthert, Sep 21, 2004
    #3
  4. Chris Thunell

    Paul Clement Guest

    On Mon, 20 Sep 2004 16:08:44 -0400, "Chris Thunell" <> wrote:

    ¤ 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
    ¤
    ¤

    I would highly recommend updating to the most current version of Jet (4.0). You may also need to
    distribute/install this version on the computers where your application is to be available.

    http://support.microsoft.com/default.aspx?scid=kb;en-us;239114


    Paul ~~~
    Microsoft MVP (Visual Basic)
     
    Paul Clement, Sep 21, 2004
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Duncan Winn

    .NET and OLEDB Providers

    Duncan Winn, Jul 2, 2003, in forum: Microsoft Dot NET
    Replies:
    0
    Views:
    508
    Duncan Winn
    Jul 2, 2003
  2. Guest

    Using OLEDB in a VB.NET Application

    Guest, Feb 9, 2004, in forum: Microsoft Dot NET
    Replies:
    4
    Views:
    211
  3. Luis
    Replies:
    4
    Views:
    207
  4. Guest

    ASP.NET Oledb data connection

    Guest, Sep 9, 2005, in forum: Microsoft Dot NET
    Replies:
    11
    Views:
    397
    Cor Ligthert [MVP]
    Sep 13, 2005
  5. Replies:
    1
    Views:
    185
    Ollie Riches
    Oct 20, 2005
Loading...

Share This Page