日期:2014-05-17 浏览次数:20441 次
sql = "select FileName,Attach from Attach where ID=" & ID & ""
ds = SqlHelper.ExecuteDataset(pConnstr, CommandType.Text, sql)
If ds.Tables(0).Rows.Count > 0 Then
For i = 0 To ds.Tables(0).Rows.Count - 1
SaveFileName = Application.StartupPath + "\Main\Data\" + Now.ToString("yyyyMMdd_HHmmss") + ds.Tables(0).Rows(i).Item("FileName")
Dim imgData() As Byte
imgData = ds.Tables(0).Rows(0).Item("Attach")
Dim fs As FileStream
fs = File.Create(SaveFileName, imgData.Length - 1)
fs.Write(imgData, 0, imgData.Length - 1)
fs.Close()
Next
End If