dwg文件不是我做的,它已经存放在sql里了,我读出来修改后就不知道把它存回去了。。。。 根据坐标、图元。。。我不会哦。。 我用试用以下的方法,但是当图文件已打开时就会出错:“文件已打开” Sub s_SaveFile() Dim iStm As ADODB.Stream Dim iRe As ADODB.Recordset Dim iConcstr As String '读取文件到内容 Set iStm = New ADODB.Stream With iStm .Type = adTypeBinary '二进制模式 .Open .LoadFromFile "E:\thisdrawing1.dwg" End With '打开保存文件的表 Set iRe = New ADODB.Recordset With iRe .Open "select * from chunks", iConc, 1, 3 .AddNew '新增一条记录 .Fields("photo") = iStm.Read .Update End With '完成后关闭对象 iRe.Close iStm.Close End Sub Sub s_ReadFile() Dim iStm As ADODB.Stream Dim iRe As ADODB.Recordset '打开表 Set iRe = New ADODB.Recordset '得到最新添加的纪录 iRe.Open "select top 1 * from chunks order by id desc", iConc, adOpenKeyset, adLockReadOnly '保存到文件 Set iStm = New ADODB.Stream With iStm .Mode = adModeReadWrite .Type = adTypeBinary .Open .Write iRe("photo") '这里注意了,如果当前目录下存在test1.jpg,会报一个文件写入失败的错误. .SaveToFile App.Path & "\thisdrawing1.dwg" End With Image1.Picture = LoadPicture(App.Path & "\test1.jpg") '关闭对象 iRe.Close iStm.Close End Sub |