CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Database

  1. #1
    Join Date
    Nov 2000
    Location
    IL, U.S.A.
    Posts
    218

    Database

    I am making a Database and the database file is in the same folder as all of the forms. Where is the properties box do I put the path to the file of the data base?


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Database

    In the properties you can enter the full path of the database. But it is much better to assign path in the run time using App.Path & "\mydb.mdb". That will help you if you install this application to the different folder on the user machine.


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Nov 2000
    Location
    IL, U.S.A.
    Posts
    218

    Re: Database

    Where in the properties do I put the path? I am putting the data base in the same folder as the VB program so where would I put the code you suggested? I noticed you had your Email address on your reply, can I email you a sequential file program that I am have problems with. If I post all the code it will just be a mess on the forum. I can send you all the forms so you can compile it. The problem is only in the main form. I always give 10 for any help I get.


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Database

    If you are using ADODC then that is the place where you enter db path (to the adodc properties). If you don't use adodc then the only place where you define the db path is the connection string

    Dim sConn As String
    Dim cn as ADODB.Connection
    dim sDBName as String

    Set cn = New ADODB.Connection
    sDBNAme = App.Path & "\YourDB.mdb"

    sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & sDBName & ";Persist Security Info=False"
    cn.ConnectionString = sConn
    cn.Open sConn


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured