国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

整站二進制數(shù)據(jù)庫文件還原

2019-11-18 16:51:16
字體:
供稿:網(wǎng)友

昨天一個在落伍的朋友給的,一個站的所有文件和圖片以二進制的方式放進了數(shù)據(jù)庫里,用下面的代碼可以把數(shù)據(jù)庫里的文件和圖片還原出來。
把得到的數(shù)據(jù)庫名字改成ToMdb.mdb,然后把下面的代碼保存成VBS格式。放在同一個目錄下,執(zhí)行這個VBS文件

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("ScrconnStr = "PRovider=Microsoft.Jet.OLEDB.4.0;Data Source=ToMdb.mdb;"

conn.Open connStr
rs.Open "wz", conn, 1, 1
stream.Open
stream.Type = 1

On Error Resume Next

Do Until rs.Eof
thePath = rs("folder") & "/"
theFolder = Left(thePath, InStrRev(thePath, "/"))
If fso.FolderExists(theFolder) = False Then
createFolder(theFolder)
End If
stream.SetEos()
stream.Write rs("body")
stream.SaveToFile str & thepath & rs("file"), 2
rs.MoveNext
Loop

rs.Close
conn.Close
stream.Close
Set ws = Nothing
Set rs = Nothing
Set stream = Nothing
Set conn = Nothing

Wscript.Echo "所有文件釋放完畢!"

Sub createFolder(thePath)
Dim i
i = Instr(thePath, "/")
Do While i > 0
If fso.FolderExists(Left(thePath, i)) = False Then
fso.CreateFolder(Left(thePath, i - 1))
End If
If InStr(Mid(thePath, i + 1), "/") Then
i = i + Instr(Mid(thePath, i + 1), "/")
Else
i = 0
End If
Loop
End Sub


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 玛多县| 新巴尔虎左旗| 那坡县| 台北市| 平湖市| 博罗县| 承德市| 芦溪县| 新田县| 公安县| 辽宁省| 东宁县| 德保县| 横山县| 观塘区| 手游| 南漳县| 隆德县| 离岛区| 绵竹市| 福贡县| 镇远县| 江门市| 静海县| 谢通门县| 屯昌县| 法库县| 扶沟县| 合水县| 清丰县| 中西区| 姚安县| 交城县| 新营市| 当雄县| 阿拉善右旗| 泊头市| 仙桃市| 涿鹿县| 苏尼特右旗| 大邑县|