Hi;
I am having a problem with implementing this script, the problem is this:
I get an error when trying to run the datagridimages.aspx file it gives me an error saying : Cast from type 'Byte()' to type 'String' is not valid.
<%@ Page Language="vb" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
ListPersons
Sub Page_Load(sender As Object, e As EventArgs)
If Not Page.IsPostBack Then
BindGrid()
End If
End Sub
Private Sub BindGrid()
' Create Instance of Connection and Command Object
Dim myConnection As SqlConnection = New SqlConnection("Data Source=172.100.13.48;" _
& "Initial Catalog=PromoStore;User Id=sa;Password=devs3rv;" _
& "Connect Timeout=15;Network Library=dbmssocn;")
Dim myCommand As SqlCommand = New SqlCommand("Select * from bags", myConnection)
' Mark the Command as a SPROC
'myCommand.CommandType = CommandType.StoredProcedure
Try
myConnection.Open()
DG_Persons.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
DG_Persons.DataBind()
Catch SQLexc As SqlException
Response.Write("Error occured while Generating Data. Error is " & SQLexc.ToString())
End Try
End Sub
Function FormatURL(strArgument) as String
Return ("readrealimage.aspx?id=" & strArgument)
End Function
Retrieving images from SqlServer and Displaying in the DataGrid.
' />
' />
' />
' />
'
Runat=server />
Send your comments to [email protected]
Back to Article list

I will really appreciate your assistance as I have been battling with this for 2 days and it doesnt seem that difficult to implement???
THANKS !!
Comments
Try turning on the trace for the page. That might help.
-Ray