dcsimg
Results 1 to 17 of 17

Thread: How can I include my database ext mdb to my VB.6.0 project

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    23

    How can I include my database ext mdb to my VB.6.0 project

    Hello Everyone,
    I need some help from you here.
    I want to include my database with ext mdb into my project, so it mean when I publish it to exe format, it will run fine without place external database inside the folder.
    I tried this include the folder the file of database.mdb is working, but how to add it directly onto the project.
    Please any step how to make it working.


    Thank you.
    Regards,
    Badjuri.

  2. #2
    New Member
    Join Date
    Jan 2017
    Posts
    14

    Re: How can I include my database ext mdb to my VB.6.0 project

    You can't include the database file in your exe file

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,843

    Re: How can I include my database ext mdb to my VB.6.0 project

    Hmmm, I do it, and have for years.

    I just throw it into my resources, and then drop a copy of it onto disk when I need it.

    There's the whole issue of where to drop it though. If it's a single-user program, probably somewhere in AppData\Local would be good (or maybe even just the user's "Documents" area). If it's a multi-user but single-computer program, somewhere in C:\ProgramData might work for you. If it's a multi-user/multi-computer program, you'll need to work out some location on a file server (or NAS box) to drop it.

    Good Luck,
    Elroy
    Last edited by Elroy; Dec 7th, 2018 at 06:48 AM.
    Any software I post in these forums written by me is provided AS IS without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that Ive been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a VB6 random code folder that is overflowing. Ive been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    23

    Re: How can I include my database ext mdb to my VB.6.0 project

    Gilman & Elroy,
    Thank you for the answer, well ...., it mean we can't do to adding the mdb file include, except we place or drop to somewhere into the local folder.

    Thank you.
    Regards,
    Badjuri.

  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,843

    Re: How can I include my database ext mdb to my VB.6.0 project

    Badjuri,

    What are you thinking? You want to read your MDB and also add records to it while it's in your EXE program? Well, I could possibly work that out, but it's a notoriously bad idea. Any program that routinely modifies its executable is probably going to be flagged as a virus. Also, if you "install" this program and place it into the Program Files (or Program Files (x86)) area, a Standard User won't have permissions to modify files in in these areas.

    Personally, I'd just never consider developing any kind of executable that got modified after it was compiled. If you need some persistent data, there are a plethora of well accepted ways to accomplish that.

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided AS IS without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that Ive been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a VB6 random code folder that is overflowing. Ive been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    23

    Re: How can I include my database ext mdb to my VB.6.0 project

    Elroy,
    I am thinking about communication of the project to a file of mdb, it mean once we have exe file we no need to include the mdb file to enable the project.exe, because the project.exe will run if the mdb is connected.

    Here are the project, I got from the forum:
    Code:
    Private Sub cmdExit_Click()
    End
    End Sub
    
    Private Sub cmdok_Click()
    If Label3.Caption = "0" Then
     MsgBox "Your TRIAL Has Been Expired...", vbYesNoCancel + vbInformation, , , , 1, True
    
    End
    Else
    Set RS = New ADODB.Recordset
    RS.Open " Select * From Table1", CN, adOpenKeyset, adLockPessimistic   'Open the table Database then refer to number
     RS!KeyID = RS!KeyID - Text1.Text
    RS.Update
    Unload Me
    progressBar.Show      'Once this okay then show next page with progress bar
    End If
    End Sub
    
    Private Sub Form_Load()
    'Dim CN As ADODB.Connection
    Set CN = New ADODB.Connection
    'CN.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database1.mdb;jet OLEDB:Database Password=000000"
    CN.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database1.mdb;jet OLEDB:Database Password=000000"     'Database1 with password 000000 to access
    CN.CursorLocation = adUseClient
    CN.Open
    frmDemo.Show
    Set RS = New ADODB.Recordset
    'RS.Open " Select * From Table1", CN, adOpenKeyset, adLockPessimistic
    RS.Open " Select * From Table1", CN, adOpenKeyset, adLockPessimistic
    Label3.Caption = RS!KeyID
    'Label4.Visible = True
    End Sub
    As well as these code above, we need to include Database1 in one folder, if Database not into a folder then the project.exe will appears error once run, inside the Database only write the numbers how many times you will open the project.exe.

    Thank you.
    Regards,
    Badjuri.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    23

    Re: How can I include my database ext mdb to my VB.6.0 project

    Elroy,
    I am thinking about communication of the project to a file of mdb, it mean once we have exe file we no need to include the mdb file to enable the project.exe, because the project.exe will run if the mdb is connected.

    Here are the project, I got from the forum:
    Code:
    Private Sub cmdExit_Click()
    End
    End Sub
    
    Private Sub cmdok_Click()
    If Label3.Caption = "0" Then
     MsgBox "Your TRIAL Has Been Expired...", vbYesNoCancel + vbInformation, , , , 1, True
    
    End
    Else
    Set RS = New ADODB.Recordset
    RS.Open " Select * From Table1", CN, adOpenKeyset, adLockPessimistic   'Open the table Database then refer to number
     RS!KeyID = RS!KeyID - Text1.Text
    RS.Update
    Unload Me
    progressBar.Show      'Once this okay then show next page with progress bar
    End If
    End Sub
    
    Private Sub Form_Load()
    'Dim CN As ADODB.Connection
    Set CN = New ADODB.Connection
    'CN.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database1.mdb;jet OLEDB:Database Password=000000"
    CN.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database1.mdb;jet OLEDB:Database Password=000000"     'Database1 with password 000000 to access
    CN.CursorLocation = adUseClient
    CN.Open
    frmDemo.Show
    Set RS = New ADODB.Recordset
    'RS.Open " Select * From Table1", CN, adOpenKeyset, adLockPessimistic
    RS.Open " Select * From Table1", CN, adOpenKeyset, adLockPessimistic
    Label3.Caption = RS!KeyID
    'Label4.Visible = True
    End Sub
    As well as these code above, we need to include Database1 in one folder, if Database not into a folder then the project.exe will appears error once run, inside the Database only write the numbers how many times you will open the project.exe.

    Thank you.
    Regards,
    Badjuri.

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,572

    Re: How can I include my database ext mdb to my VB.6.0 project

    Well rather than trying to include the database in your exe why not just create a routine that checks to see if the database exists when the program starts and if it does not exist then create it? Only requires a little code and no additional file need be included.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    23

    Re: How can I include my database ext mdb to my VB.6.0 project

    Quote Originally Posted by DataMiser View Post
    Well rather than trying to include the database in your exe why not just create a routine that checks to see if the database exists when the program starts and if it does not exist then create it? Only requires a little code and no additional file need be included.
    DataMiser,
    As well as you advise, could you please write a sample, are this can stored how many times it will count then the project doesn't run or open.

    Thank you.
    Regards,
    Badjuri.

  10. #10
    Frenzied Member
    Join Date
    Feb 2017
    Posts
    1,242

    Re: How can I include my database ext mdb to my VB.6.0 project

    Hello, check this.
    vbExtra: Print preview for VB6, print FlexGrids and more.
    MSDN online for VB6, Language reference.

  11. #11
    Frenzied Member gibra's Avatar
    Join Date
    Oct 2009
    Location
    ITALY
    Posts
    1,593

    Re: How can I include my database ext mdb to my VB.6.0 project

    Quote Originally Posted by rukmi View Post
    I want to include my database with ext mdb into my project, so it mean when I publish it to exe format, it will run fine without place external database inside the folder.
    You can't.

    Read this
    http://www.vbforums.com/showthread.p...m-uses-creates

  12. #12
    New Member
    Join Date
    Jan 2017
    Posts
    14

    Re: How can I include my database ext mdb to my VB.6.0 project

    If you want protect data or the trial period of your application, you would not hold yours passwords in plain text in your application.
    If you compile your project, you can inspect your exe and you can find something like this:

    %N*3f `ӓprogressBar :O*3f `ӓForm cmdExit L C a p t i o n  0 < Y o u r T R I A L H a s B e e n E x p i r e d . . . 5  m.V  m. @ @ @ * S e l e c t * F r o m T a b l e 1 O p e n
    K e y I D T e x t U p d a t e #= h8 +3q"= h8 +3q 8@ H@   m.P  m. h@ x@ @ ^ P R O V I D E R = M i c r o s o f t . J e t . O L E D B . 4 . 0 ; D a t a S o u r c e = yO*3f `ӓb \ D a t a b a s e 1 . m d b ; j e t O L E D B : D a t a b a s e P a s s w o r d = 0 0 0 0 0 0 C o n n e c t i o n S t r i n g

    Is very easy to find the password.

  13. #13
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,843

    Re: How can I include my database ext mdb to my VB.6.0 project

    Rukmi,

    You've expressed three somewhat independent desires in this thread:

    1. Opening and using a database wholly within an executable's resources.
    2. Creating a database from scratch onto disk with some technology (ADO, DAO, etc).
    3. Keeping track of how many times your executable has been executed.

    It would help us tremendously if you could just outline your objective so that we could directly address it with our ideas. Do you have multiple objectives? If so, you may do well to start a thread for each of them.

    The idea of opening and maintaining a database wholly within an executable's resources is a somewhat fascinating (even of somewhat dubious) idea. I suppose I would need to understand more about why you'd want to do this. All I can think of is possibly some program you'd pass around, that kept a history of what other people had done with it. However, as soon as you started making copies, you'd have a huge synchronization problem. Therefore, I'm not sure I see the immediate utility. I suppose it might be more beneficial if you could make it non-copy-able (only transferable) but I'm not sure that's possible either (or at least not very easy, and that's yet another issue).

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided AS IS without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that Ive been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a VB6 random code folder that is overflowing. Ive been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  14. #14
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,572

    Re: How can I include my database ext mdb to my VB.6.0 project

    Well if the goal is simply to keep track of how many times a program has been executed then there is no reason to use a database at all. The registry would be an option as would a simple binary file and there are other options as well. Just know that no matter how you do it there is no hack proof method.

  15. #15
    Frenzied Member ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    1,431

    Re: How can I include my database ext mdb to my VB.6.0 project

    Quote Originally Posted by rukmi View Post
    Hello Everyone,
    I need some help from you here.
    I want to include my database with ext mdb into my project, so it mean when I publish it to exe format, it will run fine without place external database inside the folder.
    I tried this include the folder the file of database.mdb is working, but how to add it directly onto the project.
    Please any step how to make it working.


    Thank you.
    Regards,
    Badjuri.
    what if you have to run the mdb in a Network drive?

    I use a Ini File for Path's to = mdb (or other Database); HelpFiles and Pictures
    the Program reads(looks) for those Paths
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    23

    Re: How can I include my database ext mdb to my VB.6.0 project

    There all,
    Thank you for your advise, as well as your enlightenment so better I use a timer, I knew this is not my expectation.
    For tested I attach that project.exe.

    Thank you.
    Regards,
    Badjuri.

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    23

    Re: How can I include my database ext mdb to my VB.6.0 project

    There all,
    Thank you for your advise, as well as your enlightenment so better I use a timer, I knew this is not my expectation.
    For tested I attach that project.exe.

    Thank you.
    Regards,
    Badjuri.
    Attached Files Attached Files

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width