Enter the mdb database to unpack the packaged MDB file.

Source: Internet
Author: User
Tags mdb database unpack

Many directly include all the files on the server Program , Images and other files are encapsulated into mdb, and the following file is required.
Dim RS, WS, FSO, Conn, stream, connstr, thefolder
Set rs = Createobject ("ADODB. recordset ")
Set stream = Createobject ("ADODB. Stream ")
Set conn = Createobject ("ADODB. Connection ")
Set FSO = Createobject ("scripting. FileSystemObject ")
Dbname = inputbox ("Enter the database name. The database must be in the same directory as the program", "Mc package and decompress the script ")
Connstr = "provider = Microsoft. Jet. oledb.4.0; Data Source =" & dbname &";"

Conn. Open connstr
Rs. Open "select * from [filedata]", Conn, 1, 1
Stream. Open
Stream. type = 1

On Error resume next

Do until Rs. EOF
Thefolder = left (RS ("path"), faster Rev (RS ("path "),"\"))
If FSO. folderexists (thefolder) = false then
Createfolder (thefolder)
End if
Stream. seteos ()
Stream. Write RS ("file ")
Stream. savetofile STR & RS ("path"), 2
Rs. movenext
Loop

Rs. Close
Conn. Close
Stream. Close
Set Ws = nothing
Set rs = nothing
Set stream = nothing
Set conn = nothing

Wscript. Echo "all files have been released! "

Sub createfolder (PATH)
Dim I
I = instr (path ,"\")
Do while I> 0
If FSO. folderexists (left (path, I) = false then
FSO. createfolder (left (path, I-1 ))
End if
If instr (mid (path, I + 1), "\") then
I = I + instr (mid (path, I + 1 ),"\")
Else
I = 0
End if
Loop
End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.