Function PutPic1(ByVal FPicTable As String, ByVal DPicField As String, ByVal DPicId As String, ByVal PicId As String, ByVal TempId As String) As Integer
'将数据库内的二进制文件转化成临时图片
'FPicTable 图片的数据表
'DPicField 图片的数据字段
'DPicId 图片的数据编号
'PicId 图片的数据编号数据
On Error GoTo PutPicErrorDim B As String
Dim BytFile() As Byte '二进制数组
Dim TmpRs As New Recordset
Dim TmpBoolean As String
Dim GetPutPicPath As String
GetPutPicPath = App.Path & "\temp.bmp" TmpRs.Open "select * from " & Trim(FPicTable) & " where " & Trim(DPicId) & "='" & Trim(PicId) & "'", CnnSql, adOpenKeyset, adLockOptimistic
If Not TmpRs.EOF Then
B = TmpRs(DPicField).ActualSize
If B <> 0 Then
BytFile = TmpRs(DPicField).GetChunk(B)
Open GetPutPicPath For Binary As #2
Put 2, , BytFile
Close #2
TmpRs.Close
PutPic = 1
Else
PutPic = 0
End If
Else
PutPic = 0
End If
Exit Function
PutPicError:
PutPic = 0
End FunctionFunction GetPic1(ByVal FPicTable As String, ByVal DPicField As String, ByVal DPicId As String, ByVal PicId As String, ByVal TempId As String) As Integer
'将临时图片转化成二进制文件存放在数据库内
'FPicTable 图片的数据表
'DPicField 图片的数据字段
'DPicId 图片的数据编号
'PicId 图片的数据编号数据
On Error GoTo GetPicErrorDim B As String
Dim BytFile() As Byte '二进制数组
Dim TmpRs As New Recordset
Dim TmpBoolean As String
Dim GetPutPicPath As String
GetPutPicPath = App.Path & "\temp.bmp"
Open GetPutPicPath For Binary As #1
B = LOF(1)
ReDim BytFile(B)
Get 1, , BytFile
TmpRs.Open "select * from " & Trim(FPicTable) & " where " & Trim(DPicId) & "='" & Trim(PicId) & "'", CnnSql, adOpenKeyset, adLockOptimistic
If Not TmpRs.EOF Then
TmpRs.Fields(Trim(DPicField)).AppendChunk (BytFile)
TmpRs.Update
End If
Close #1
Exit Function
GetPicError:
GetPic = 0
End Function
看看这
解决方案 »
- 紧急求助:asp 下载统计
- 你好。我想问一下,我想请教一下,如果在串口传输的时候,我想把要传输的数据挂起,再下次发送的时候继续发送,如何才能做到
- 求助:如何使程序开机自动运行,在程序运行的时候不能切换到其他程序?
- 寻求方案,大家帮忙
- 如何使一个外部程序(非vb本地程序)在后台运行?
- 各位vb程序员有多少是系统的学过数据结构和离散数学的?
- hnlzh(吸海垂虹)请发一份http://www.csdn.net/expert/topic/231/231348.shtm中提的代码可以吗?
- 有谁知道系统获知MOUSE指针将要变化的消息是哪一条?
- 如何用listview实现outlook express的效果?
- 看看代码
- 求一个宏,用于excel
- 各位同道谁能够给我一些好的图标或小的图片,在线急等。
Dim cnn As New ADODB.Connection
Dim rst1 As Recordset
Dim bit() As Byte Set rst1 = adoconnect3("db2.mdb", "表1", "*", "")
'If Not (rst1.EOF And rst1.BOF) Then
If Mypicture = "" Then
' 然后将字节数组的内容写入数据库即可
rst1.Fields("Picture") = ""
rst1.UpdateBatch
Else
Open Mypicture For Binary As #1
ReDim bit(LOF(1)) As Byte
Get 1, 1, bit
Close 1
' 然后将字节数组的内容写入数据库即可
rst1.AddNew
rst1.Fields("Picture").AppendChunk bit
rst1.Fields("Name") = "姓名"
rst1.UpdateBatch
End If
'End If
End Sub
TmpRs.Open "select * from " & Trim(FPicTable) & " where " & Trim(DPicId) & "='" & Trim(PicId) & "'", CnnSql, adOpenKeyset, adLockOptimistic
If Not TmpRs.EOF Then
TmpRs.Fields(Trim(DPicField)).AppendChunk (BytFile)
TmpRs.Update
End If以上如果对你有帮助的话可记得要多送分哟!哈哈--小马哥和大家问好了!
我已经结分了,怎么没显示出来?
还有我问你,你不存入文件,又怎样获得ByFile呢?
我已经结分了,怎么没显示出来?
还有我问你,你不存入文件,又怎样获得ByFile呢?