Results 1 to 28 of 28

Thread: VB6 Exe Inside MySql

Threaded View

  1. #17
    Addicted Member
    Join Date
    Aug 2023
    Posts
    201

    Re: VB6 Exe Inside MySql

    Quote Originally Posted by ricardoweb084 View Post
    Hi everyone,

    I use VB6 + MySQL.

    The database is on a server exclusively for MySQL, and I don't have space to store files. This is the problem.
    My clients are far away from me, so I have to access each machine remotely and do the update.
    If you really don't have space forget your original idea because storing a exe in a DB will need more space than if you store it in a standard way.

    So I assume that you have space but you don't have a shared resource to store files and as other suggest this is something that should be discussed with your client because...you're app needs it (or store it in Google Drive or whatever free cloud storage).

    But, if you still want to put a gun in your head and continue in that way (store the exe in the DB) you can do it, just use a table with a BLOB type field. This example store the exe in the DB (using DAO, but you can use also ADO), not tested, write on the fly:

    Code:
    Dim bytdata() As Byte
    dim rs as dao.recordset
    dim db as dao.database
    Set db= OpenDatabase("", True, False, "odbc;DRIVER={your_driver};SERVER=your_server;DATABASE=your_db;UID=username;PWD=password;OPTION=16427;")
    Open "myexefile.exe" For Binary As #1
    ReDim bytdata(LOF(1))
    Get #1, , bytdata
    Close #1
    Set rs = DB.OpenRecordset("your_table'", dbOpenDynaset, dbSeeChanges)
    rs.addnew
    rs.Fields("field_for_exe").AppendChunk bytdata
    rs.update
    rs.close
    db.close
    to extract the exe (if you want the latest you can change the SQL query to get the newest):

    Code:
    dim rs as dao.recordset
    dim db as dao.database
    dim b() as byte
    Set DB = OpenDatabase("", True, False, "odbc;DRIVER={your_driver};SERVER=your_server;DATABASE=your_db;UID=username;PWD=password;OPTION=16427;")
    Set rs = DB.OpenRecordset("Select field_for_exe From your_table where id = '" & id_of_your_exe & "'", dbOpenSnapshot)
    ReDim B(Len(rs("field_for_exe")))
    b=rs("field_for_exe")
    Open "path_and_exe_name.exe" For Binary As #10
    Put #10, , B
    Close 10
    rs.close
    db.close
    But take a look to all of our posts: this is not a good idea.
    Last edited by zx81sp; Oct 4th, 2024 at 10:41 AM.

Tags for this Thread

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