该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Dim odbcstr As String, adocon As New ADODB.Connection
odbcstr = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ebtrpt;Initial Catalog=LH"
adocon.Open odbcstr
Dim office_rst As New ADODB.Recordset
adocon.CursorLocation = adUseClient
office_rst.Open "UpdatePic", adocon, adOpenDynamic, adLockOptimistic, adCmdTable
Dim adofld As ADODB.Field, DataArr() As Byte, filelen As Long, file_num As Long
office_rst.AddNew
'Set adofld = office_rst("图片名")
office_rst("图片名").Value = CommonDialog1.FileTitle
file_num = FreeFile '返回一个 Integer,代表下一个可供Open语句使用的文件号
Open Text1.Text For Binary Access Read As file_num '打开磁盘文件
filelen = LOF(file_num) '求文件长度
ReDim DataArr(filelen) '根据文件长度定义动态数组大小
Get file_num, , DataArr '将一个已打开的磁盘文件读入数组变量之中
adofld.AppendChunk DataArr() '将数组内容存入image型字段中
Close file_num '关闭磁盘文件
office_rst.Update
adofld.AppendChunk DataArr() '将数组内容存入image型字段中
这里会出现对象变量或with块变量的错误 - -