locked
VB2008 Express - Cannot Get Connection String to Prompt/Take RRS feed

  • Question

  • Folks:


    i'm still having problems getting connection inside vb2008 express over to my database (Access).

     

    I create new database connection, select Access.  The screen skips the entire part about browsing to select the database file.  The screen jumps straight to a screen asking for the connection string.

     

    I type some test file path like...

     

    "provider=microsoft.jet.oledb.4.0;data source=c:\tmp\tmp.mdb"

     

    The "test" button says that all is OK.  I use with and without quotes. 

     

    No matter what I type manually, I get the error message...

     

    format of the initialization string does not conform to specification starting at index 0.

     

    Question... How can I select a file and get the connection string built... or secondly, what should the connection string be?

     

    Monday, June 23, 2008 8:41 PM

Answers

  •  

    Dandy,

     

    I have some goodnews and some bad news.

     

    The good news is that this condition is repairable.

     

    The bad news is that it is caused by registry corruption.

     

    The good news is that Spotty, an MS Employee has identified and described a fix and has posted it in this forum.

     

    The bad news is that I sure don't remember the name of the post. The worse news is that he has made 1700 posts to this forum.

     

    I would begin with search  and looked for Spotty and the phrase grayed-out or Access

     

    Spotty,grayed-out

    Spotty,Access

    Spotty,registry

    Spotty,fix

     

    and keep being creative about your search keywords.

    Tuesday, June 24, 2008 3:59 AM

All replies

  • Do this IN CODE!!

     

    Private ReadOnly ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\tmp\tmp.mdb"

    Private cn As New OleDbConnection(ConnString)

     

    Or use the ConnectionStringBuilders

     

    Private cn As OleDbConnection
    Private ConnString As OleDbConnectionStringBuilder
     
    ConnString = New OleDbConnectionStringBuilder()
    ConnString.Provider = "Microsoft.Jet.OLEDB.4.0"
    ConnString.DataSource = "C:\tmp\tmp.mdb"
    cn = New OleDbConnection(ConnString.ConnectionString)

     

    MS Access OLE DB & OleDbConnection (.NET framework) connection strings

    Open connection to Access database:
    "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb; User Id=admin; Password="

    Open connection to Access database using Workgroup (System database):
    "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb; Jet OLEDB;System Database=c:\App1\Your_System_Database_Name.mdw"

    Open connection to password protected Access database:
    "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb; Jet OLEDB;Database Password=Your_Password"

    Open connection to Access database located on a network share:
    "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\Server_Name\Share_Name\Share_Path\Your_Database_Name.mdb"

    Open connection to Access database located on a remote server:
    "Provider=MS Remote; Remote Server=http://Your-Remote-Server-IP; Remote Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb"

     

    Monday, June 23, 2008 9:55 PM
  • Thanks for the nice response, John.  I'm sure that this will work in code.

     

    Question... how do I answer the GUI prompts for the "Add Connection" pop-up?

     

    At the top of the form it already has answerred "Microsoft Access Database File (OLE DB)

     

    The screen shows - Misc on tree with

    Connection String located under that.  The CS is Blank!

     

    The <Advanced> button is dimmed out.

     

    When I type either the Provider and Data Source...

    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\tmp\tmp.mdb

     

    or the Data Source by itself...

    Data Source=C:\tmp\tmp.mdb

     

    into the field, I get the error message...

     

    "Format of the initialization string does not confrom to the specification starting at index 0."

     

    Can you help me figure out how to get the intereactive database selection screen to work correctly with Access?

     


    Thanks, D.

     

     

    Tuesday, June 24, 2008 12:09 AM
  •  

    Dandy,

     

    I have some goodnews and some bad news.

     

    The good news is that this condition is repairable.

     

    The bad news is that it is caused by registry corruption.

     

    The good news is that Spotty, an MS Employee has identified and described a fix and has posted it in this forum.

     

    The bad news is that I sure don't remember the name of the post. The worse news is that he has made 1700 posts to this forum.

     

    I would begin with search  and looked for Spotty and the phrase grayed-out or Access

     

    Spotty,grayed-out

    Spotty,Access

    Spotty,registry

    Spotty,fix

     

    and keep being creative about your search keywords.

    Tuesday, June 24, 2008 3:59 AM
  • Renee:  I will pursue the information as you stated. 

     

     

    Thanks, D

     

    Wednesday, June 25, 2008 10:41 AM
  • Folks,

     

    Since I notice that no-one has given the full solution here is one that I found for the "format of the initialization string does not conform to specification starting at index 0" issue in the VS2008 IDE.

     

    If you cannot get the Access Database File selection dialog when you choose Tools\Connect to Database in the VS2008 IDE then first check:

     

    http://www.svenmaes.blogspot.com/2008/02/connecting-to-access-database-in-visual.html

     

    But if the key mentioned there (MSIDSX.1 in HKEY_CLASSES_ROOT\CLSID\{F9AE8980-7E52-11d0-8964-00C04FD611D7}\ProgID ) is all present and correct (which in my case it was) and it still doesn't work. Then your OLE DB configuration is corrupt and you need to re-register the OLE DB DLL's, this website provides a useful bat file (in text form) to help you do that, I only used the stuff for step 4 on that page btw:

     

    http://www.trinet.co.uk/kb.asp?kbid=000027

     

    Resolved it for me!

     

    Hope that helps,

     

    Martin Searle

    University of Kent, UK

     

    http://www.sprint15.com

    Thursday, July 10, 2008 12:02 PM