资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

如何用VB把图片上传到,SQL的IMAGE字段里面

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

如何用VB把图片上传到,SQL的IMAGE字段里面.

网友回答:

发表者:riverlee

Private   Sub   ImportBLOB()  
   
  Dim   rs   As   New   ADODB.Recordset  
  Dim   stm   As   ADODB.Stream  
   
  Set   stm   =   New   ADODB.Stream  
   
    Skip   any   table   not   found   errors  
  On   Error   Resume   Next  
  cn.Execute   "drop   table   BinaryObject"  
   
  On   Error   GoTo   0  
  Create   the   BinaryObject   table  
   
  rs.Open   "Select   *   from   a   where   1=2",   cn,   adOpenKeyset,   adLockOptimistic  
  Read   the   binary   files   from   disk  
  stm.Type   =   adTypeBinary  
  stm.Open  
  stm.LoadFromFile   App.Path   &   "\1.bmp"  
   
  rs.AddNew  
  rs!c   =   App.Path   &   "\1.bmp"  
  rs!r   =   stm.Read  
   
  Insert   the   binary   object   in   the   table  
  rs.Update  
   
  rs.Close  
  stm.Close  
   
  Set   rs   =   Nothing  
  Set   stm   =   Nothing  
  End   Sub  
 


 

 
热门推荐笔记本: IBM笔记本
相关文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved