Results 1 to 3 of 3

Thread: [RESOLVED] data environment and path to db

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    TNQ
    Posts
    40

    Resolved [RESOLVED] data environment and path to db

    I have built my app using VB6 and it runs from a usb thumbdrive. I use a coded connection to my db as follows

    Code:
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\stock.mdb"
    What this provides is basically wherever my app runs, so long as the db is in the same folder it can find and use it. However, when I come to print the datareport I get errors. (I believe it's a 713?)

    What I would like to know is, can this type of connection be used in the data environment which currently connects to the db like this

    Code:
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\stock\stock.mdb;Persist Security Info=False
    This will only print the datareport if the db is on the F:\stock drive folder. It needs to be dynamic as not every computer will make the app folder F.
    I have tried substituting the code but it doesn't seem to want to know.

    Any ideas greatly appreciated.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: data environment and path to db

    In code you can override the property settings

    DataEnvironment1.Connection1.ConnectionString = "provider=..."

    The dataenvironment is a global object so this can be done anywhere. Sub Main or Form_Load of the main form.

    Another place is the DataEnvironment's WillConnect event.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    TNQ
    Posts
    40

    Re: data environment and path to db

    Quote Originally Posted by brucevde
    In code you can override the property settings

    DataEnvironment1.Connection1.ConnectionString = "provider=..."
    Excellent. Seems to work like a charm but I won't get a chance to try it properly until tomorrow.

    Cheers.

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