如题,我仿照坛子里的类似帖子写了以下代码:
If CommonDialog1.FileName <> "" Then
Set StmPic = New ADODB.Stream
StmPic.Type = adTypeBinary
StmPic.Open
StmPic.LoadFromFile (CommonDialog1.FileName)
cn.Open strCN
cn.Execute "insert into incoming_issue(issue_date,piece_part,part_no,vendor,vendor_lot,pkg,pkg_code,assylot_no,assylot_qty,defect_qty,iqc_date,cqi_no,disposal,defect_rate,disc,pic)values('" & dtpDate.Value & "','" & cboPiece_Part.Text & "','" & txtPart_No.Text & "','" & txtVendor.Text & "','" & txtVendor_Lot.Text & "','" & cboPKG.Text & "','" & cboCode.Text & "','" & txtLot.Text & "','" & txtInput_Qty.Text & "','" & txtDef_Qty.Text & "','" & txtIQC_Date.Text & "','" & txtCQI_No.Text & "','" & txtDisposal.Text & "','" & lblRate.Caption & "','" & txtDisc.Text & "','" & StmPic.Read & "')"
cn.Close
CommonDialog1.FileName = "" '清空是防止重复按Save鍵,造成重复保存图像
End If错误代码如下:
[Microsoft][ODBC Microsoft Access Driver]Syntax error in string in query expression
我想把图片写入PIC中,PIC已经设置为OLE。
另外求教,如何用sql语句更新我数据库中的ole图片,以及如何用SQL语句将数据库中的ole图片读取到IMAGE控件中?
If CommonDialog1.FileName <> "" Then
Set StmPic = New ADODB.Stream
StmPic.Type = adTypeBinary
StmPic.Open
StmPic.LoadFromFile (CommonDialog1.FileName)
cn.Open strCN
cn.Execute "insert into incoming_issue(issue_date,piece_part,part_no,vendor,vendor_lot,pkg,pkg_code,assylot_no,assylot_qty,defect_qty,iqc_date,cqi_no,disposal,defect_rate,disc,pic)values('" & dtpDate.Value & "','" & cboPiece_Part.Text & "','" & txtPart_No.Text & "','" & txtVendor.Text & "','" & txtVendor_Lot.Text & "','" & cboPKG.Text & "','" & cboCode.Text & "','" & txtLot.Text & "','" & txtInput_Qty.Text & "','" & txtDef_Qty.Text & "','" & txtIQC_Date.Text & "','" & txtCQI_No.Text & "','" & txtDisposal.Text & "','" & lblRate.Caption & "','" & txtDisc.Text & "','" & StmPic.Read & "')"
cn.Close
CommonDialog1.FileName = "" '清空是防止重复按Save鍵,造成重复保存图像
End If错误代码如下:
[Microsoft][ODBC Microsoft Access Driver]Syntax error in string in query expression
我想把图片写入PIC中,PIC已经设置为OLE。
另外求教,如何用sql语句更新我数据库中的ole图片,以及如何用SQL语句将数据库中的ole图片读取到IMAGE控件中?
解决方案 »
- 请问如何编写程序判断一个数是不是偶数,Clear_Zero快来帮我!
- 各位大哥:如何把一个小数转换成规定的小数位数
- 怎样VB实现带输入参数传递的连接数据库方法
- 大家来放松一下,有深圳的程序吗?
- word怎么保存在sql server 里,字段用什么类型,怎么操作。
- 请playyuer(女㊣爱)及其它高手提供一些经典实用的ADO语法或SQL语句或(MSDN上有的就不要提供了)
- 請教: 運行一個sql語句,如何只取出datetime字段中的date部分?
- 关于错误处理的问题
- 关于快捷方式所指向的文件路径!
- 求助for循环语句,整个编码写的对吗
- 倾所有积分,拜求一简单但小弟没有解决的问题!
- SELECT INTO 语句创建一个新表?
bteContent是一个二进制数组。bteContent = objAdoRecS.Fields("imageFile").GetChunk(objAdoRecS.Fields("imageFile").ActualSize)从二进制数组写入数据库:objAdoRecS.Fields("imageFile").AppendChunk bteContent
http://support.microsoft.com/default.aspx?scid=kb;zh-cn;258038把Access的OLE字段当做SQLServer BLOB类型即可!
//这样会把Stream当做字符串应该INSERT后用UPDATE更新该字段,用可以用ADODB.Command的Parameters,或者就用rs.Update的方法更新
无法用SQL语句进行编辑
你可以参照上面两位的建议
用stream进行更新