Results 1 to 5 of 5

Thread: simple question from a newbie

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Location
    ottawa, canada
    Posts
    233

    Question simple question from a newbie

    I am learning to code databases without the use of datacontrols.

    I have an access db called calibrations in the following path

    c:\CALIBRATIONS.mdb

    using the code below how can i incorporate my database path in the <" & App.Path & "\Data1.mdb;" > section

    using Data Source=" c:\CALIBRATIONS.mdb;" deosnt work.



    conConn.ConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data1.mdb;"

  2. #2
    Member
    Join Date
    Nov 2002
    Location
    San Antonio, TX
    Posts
    35
    What's your question? It looks like you're trying to use ADO is this correct? What are you trying to accomplish?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Location
    ottawa, canada
    Posts
    233
    In the past i have used data controls using vis data. However, these have become problematic as i have many tables and queries, as a result i have been given a code example to mimic the data control. I have been given code to make a connection to ms Access Database in Access 2000 format. But i dont know how to substitute my database in the the following example..


    data source =" & App.Path & "\Data1.mdb;"

    Deos the 'App.Path' refer to my database name and path?, and what deos 'Data1.mdb' refer to?

    Hope this helps

  4. #4
    Member
    Join Date
    Nov 2002
    Location
    San Antonio, TX
    Posts
    35
    App.Path is the path to your VB application, Data1.mdb is the name of the database.

    If you use

    app.path & "databasename.mdb"

    in your connection string your database must reside in the same folder as your application.

  5. #5
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    App.Path refers to the file of your Executable. If you are running the code through the VB environment, it will return the path to the project file(vbp).
    Mdb file is the database file that you are using.
    Where exactly is your MDB file stored? In the applications directory of in the "c:\".
    In case it si in hte C:\ you should rather use
    VB Code:
    1. conConn.ConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Data1.mdb;"

    otherwise if the database is in with executable/project, then the one you are using should work fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width