为什么Image没有显示在名为Image1的GridView和Image控件中? [英] Why Image is not displaying in GridView and Image control named Image1?
本文介绍了为什么Image没有显示在名为Image1的GridView和Image控件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么Image没有显示在名为Image1的GridView和Image控件中?
我的VB代码在下面给出
Why Image is not displaying in GridView and Image control named Image1?
My VB code is given below
Try
Dim sql As String = "SELECT PHOTO FROM IMAGE WHERE "
sql += "ID='" & txtID.Text & "'"
cmd = New OracleCommand(sql, Con)
ds = New DataSet
da = New OracleDataAdapter(cmd)
Try
If Con.State = ConnectionState.Closed Then
Con.Open()
End If
Catch ex As Exception
Response.Write(ex.Message)
Exit Sub
End Try
da.Fill(ds, "IMAGE")
gvImages.DataSource = ds
gvImages.DataBind()
If Con.State = ConnectionState.Open Then
Con.Close()
End If
Dim filepath As String = Server.MapPath(".\App_Data\temp\")
Dim fullpath As String = filepath & "\"
If Not (System.IO.Directory.Exists(fullpath)) Then
System.IO.Directory.CreateDirectory(fullpath)
End If
Dim path As String = fullpath & lblblob.Text
Image1.ImageUrl = path
Catch ex As Exception
Response.Write(ex.Message)
End Try
预先感谢您
I appreciate you in advance
推荐答案
更改此行:
Change this line:
gvImages.DataSource = ds
到
to
gvImages.DataSource = ds.Tables(0)
此外,关于路径",请确保其正确形成.
Further, about ''path'', make sure its correctly formed.
这篇关于为什么Image没有显示在名为Image1的GridView和Image控件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文