如何在数据库中加载图片? [英] How to load Picture in database?

查看:81
本文介绍了如何在数据库中加载图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub Combo_Click()                       //display picture on combo click
sql="select ID,PICS from table1 where ID="& val(Combo) &"
Set RES = CON.Execute(sql)
Picture1.Picture = RES!PICS
End Sub

Private Sub Command_Click()                    //insert picture in table
strSQL = "insert into TABLE1(PICS)"
strSQL = strSQL + "values(" & Picture1.Picture & " ) "
strSQL = strSQL + "where ID="& val(Combo) &""
Set RES = Cn.Execute(strSQL)
Rs.Close
End Sub







现在错误是:




Now Error is that:

1.sql command is not properly ended.<br />
<br />
?strsql<br />
insert into TABLE1(PICS)values(-251326960 ) where ID = 1<br />
<br />
2.type mismatch<br />
<br />
Picture1.Picture = RES!PICS





请帮忙......... ....



Please help.............

推荐答案

PICS列的类型是什么?



我是猜测-251326960是图片句柄。你必须extr自己动作图像数据并存储在blob数据字段中。
What is the type of the PICS column?

I''m guessing the -251326960 is the picture handle. You have to extract the image data itself and store in a blob data field.


你已经打印 strSQL 但是它是 sql 这是不正确的

You''ve printed strSQL but it''s sql that is not correct
sql="select ID,PICS from table1 where ID="& val(Combo ) &"



我强调的那一点不应该在那里



对于问题的第二部分,请参阅上面的micke.andersson的解决方案 - 周围有很多例子


the bit I''ve underlined should not be there

For the 2nd part of your problem see micke.andersson''s solution above - there are plenty of examples around


这篇关于如何在数据库中加载图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆