
April 27th, 2003, 02:18 AM
|
|
Registered User
|
|
Join Date: Apr 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
images in a datagrid
<img border="0" src="/forum/emoticons/confused.gif" height="22" width="15" alt="confused" /> <br>Can anyone help me?????????/<br>I ma trying to display images in a data grid, from sql. but only the first picture is shown no matter how many are there.<br>My code is, <br>-----------------------------------<br>Dim strConnection As String = ConfigurationSettings.AppSettings("uks")<br> Dim objConnection As New SqlConnection(strConnection)<br><br> Dim strSQL As String = "SELECT img_name, img_data, img_contenttype " & _<br> "FROM image;"<br> <br> Dim objCommand As SqlCommand = New SqlCommand(strSQL, objConnection)<br> <br> objConnection.Open()<br><br> Dim dr As SqlDataReader = objCommand.ExecuteReader()<br> If dr.Read()<br> Response.ContentType = (dr.Item(("img_contenttype")).ToString())<br> Response.BinaryWrite(dr.item("img_data"))<br> End If <br> <br> dgNameList.DataSource = dr<br> dgNameList.DataBind()<br> objConnection.Close()
|