[VB.NET]急求解答!怎样读取access中的图片


急求解答!怎样读取access中的图片
大家好,我用vb.net连接access数据库,读取一个表的中的字段,这个字段是图片,但是一般图片应该是用路径表达,但是这个表里的图片却是“包”,我应该怎么读取,谢谢大家的帮助!!!
__________________________________________________________________________
我的代码是这样的,从pro表中取字段tupian

Dim str As String
str = Request.QueryString( id )
Dim cnn As OleDbConnection
cnn = New OleDbConnection( Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Inetpub/wwwroot/home/data/Jaqua_Product.mdb )
Dim cmd As OleDbCommand
cmd = New OleDbCommand( select cpleibie,tupian from PRO where cpleibie= & str & )

cmd.Connection = cnn
cnn.open()
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()

Response.Write(













































) do while dr.Read() Response.Write( ) Response.Write( )__________________________________________________________________________转换成二进制流来读,例如: private void ReadPicture(int ID) { string sql = SELECT Picture,FileSize,ContentType FROM table WHERE ID = ID;//FileSize为图片大小,ContentType为图片格式 // Create Connection object OleDbConnection dbConn = new OleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Inetpub/wwwroot/home/data/Jaqua_Product.mdb ); // Create Command Object OleDbCommand dbComm = new OleDbCommand(sql,dbConn); // Open Connection dbConn.open(); // Execute command and receive DataReader OleDbDataReader dbRead = dbComm.ExecuteReader(); dbRead.Read(); // Clear Response buffer Response.Clear(); // Set ContentType to the ContentType of our file // Response.ContentType = (string)dbRead[ ContentType ]; // Write data out of database into Output Stream Response.OutputStream.Write((byte[])dbRead[ Picture ],(int)dbRead[ FileSize ]); // Close database connection dbConn.Close(); // End the page Response.End(); } 把图片转换成二进制流.__________________________________________________________________________谢谢taoyuming(知识就是财富) 真诚的回答!__________________________________________________________________________
ID PASSWORD
+ dr.GetString(0) + + dr.GetString(1) +

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...