Results 1 to 4 of 4

Thread: [2005] Compile with .MDB File

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    8

    [2005] Compile with .MDB File

    Hello,
    In one of my subs, I have the code:

    VB Code:
    1. Dim sConStr As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data " _
    2. & "Source=data.mdb"

    Fair enough, that works fine in Debug mode, but when I come to Publish the project, make the setup.exe file and run it, it says cannot fine data.mdb. How can I make it so that when you publish the project, the database file is included. Also, I have an image file which is uses in the project, so that would need to be included aswell.

    Thanks for any help

  2. #2
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: [2005] Compile with .MDB File

    You need to add the full path name to the source.

    VB Code:
    1. Dim sConStr As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data " _
    2. & "Source=C:\data.mdb"

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    8

    Re: [2005] Compile with .MDB File

    What if the user's drive isn't C for example? Or they don't install it on their hard drive? Or I don't know what the full path would be? What must I do instead?

    Thanks

  4. #4
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: [2005] Compile with .MDB File

    Quote Originally Posted by doof92
    What if the user's drive isn't C for example? Or they don't install it on their hard drive? Or I don't know what the full path would be? What must I do instead?

    Thanks
    You can place the mdb file in the application path and use the following to find the mdb in the application folder.

    VB Code:
    1. Dim sConStr As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data " _
    2. & "Source=" & Application.StartupPath & "\" & data.mdb"

    If the mdb is not going to be on the end user's hard drive then you need to use the path the mdb on a server some place.


    You should know exactly where the mdb is located, if you don't there is another logic problem.

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

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