Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:19:43+00:00 2026-06-18T12:19:43+00:00

I am creating a 32bit app on an old XP machine, this app will

  • 0

I am creating a 32bit app on an old XP machine, this app will run on Win7 or later as well.

so I am trying to test for what connection string will work. Such as:

Private Function test_ace_or_jet(ByVal mdb_path As String) As String
        Dim connString As String
        Dim dbMaintPort As OleDb.OleDbConnection

        connString = ""

        Try
            connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & mdb_path

            dbMaintPort = New OleDb.OleDbConnection(connString)
            dbMaintPort.Open()

            dbMaintPort.Close()

            MsgBox("1 was found")
        Catch ex As Exception
            MsgBox("Could not open 1" & vbCrLf & vbCrLf & ex.Message)
            Try
                connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb_path
                dbMaintPort = New OleDb.OleDbConnection(connString)
                dbMaintPort.Open()
                dbMaintPort.Close()

                MsgBox("2 was found")
            Catch ex2 As Exception
                connString = ""
                MsgBox("Could not open 2" & vbCrLf & vbCrLf & ex2.Message)
            End Try
        End Try
        test_ace_or_jet = connString
    End Function

However the issue that I’ve found is that on the XP machine, the first connection string does not fail. It does not have ACE installed at all.

How can I test whether to use one or the other? Am I able to get the above function to give me the correct connection string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:19:44+00:00Added an answer on June 18, 2026 at 12:19 pm

    if you keep doing your try/catch until you find something, you might be nesting yourself quite deep… You may be better (while testing), doing a loop and have an array of connection strings something like

    Private Function test_ace_or_jet(ByVal mdb_path As String) As String
       Dim connString As String
       Dim dbMaintPort As OleDb.OleDbConnection
       Dim ValidConnection As Boolean
       Dim finalConnection As String
       Dim connStrings(2) As String
       connStrings(0) = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & mdb_path
       connStrings(1) = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb_path
       connStrings(2) = "AnyOtherProviderTestConnectionStrings..."
    
       ValidConnection = False
       For value As Integer = 0 To 2
          Try
             dbMaintPort = New OleDb.OleDbConnection(connStrings(value))
             dbMaintPort.Open()
             dbMaintPort.Close()
    
             MsgBox("Success: " & connStrings(value))
             ValidConnection = True
             finalConnection = connStrings(value)
          Catch 
          End Try
    
          if ValidConnection
             exit
          endif 
    
       Next
    
       ; continue with whatever else you want to do with test result and final string
    
    End Function
    

    Also, have you had a look at ConnectionStrings.com? They might give you more options, and connection samples to test different providers and such.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating a server-side socket will fail if I'm trying to use the same port
I'm trying to run a rails app using nginx and thin. I have configured
I am creating a test app to load test a comet servlet by creating
Using Delphi XE2 on Win 7 64 bit creating a 32 bit app... In
Creating an a app, where I store bunch of photos in the drawable folder,
Creating a simple RPG game, first time using XNA. Trying to get my character
Hi I am creating a method that will take a number and print it
Can anybody give me some hints for solving this? I'm trying to compile Kinect
I'm creating a twitter client without from scratch and on my 64bit machine at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.