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" %>
Sub Page_Load(sender As Object, e As EventArgs)
If Not Page.IsPostBack Then
Private Sub BindGrid()
' Create Instance of Connection and Command Object
Dim myConnection As SqlConnection = New SqlConnection("Data Source=22.214.171.124;" _
& "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
DG_Persons.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Catch SQLexc As SqlException
Response.Write("Error occured while Generating Data. Error is " & SQLexc.ToString())
Function FormatURL(strArgument) as String
Return ("readrealimage.aspx?id=" & strArgument)
Retrieving images from SqlServer and Displaying in the DataGrid.
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???