Jump to content
Xtreme .Net Talk

reiqwans

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by reiqwans

  1. is it possible for me to see the code you used for that page maybe i could figure out a way around my current problem to find a solution
  2. 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" %> <html> <head> <title>ListPersons</title> <script runat=server> 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) 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 </script> </head> <body style="font: 10pt verdana"> <h3 align=center>Retrieving images from SqlServer and Displaying in the DataGrid.</h3> <form id="Form1" method="post" runat="server"> <asp:DataGrid ID="DG_Persons" AutoGenerateColumns=False Width="99%" HeaderStyle-BackColor="#ff0000" HeaderStyle-Font-Bold="True" HeaderStyle-Font-Name="Verdana" HeaderStyle-Font-Size="13px" HeaderStyle-ForeColor="#ffffff" ItemStyle-BackColor=Beige ItemStyle-Font-Name="verdana" ItemStyle-Font-Size="13px" BorderColor="#000000" Runat=server> <Columns> <asp:TemplateColumn HeaderText="Name"> <ItemTemplate> <asp:Label Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "code") %>' /> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="Email"> <ItemTemplate> <asp:Label Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "description") %>' /> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="Sex"> <ItemTemplate> <asp:Label Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "division") %>' /> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="Date of Birth"> <ItemTemplate> <asp:Label Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "unit_price") %>' /> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="Image"> <ItemTemplate> <asp:Image Width="150" Height="125" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "picture")) %>' Runat=server /> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> </form> <br><br><br> <p align=center><font size=2> Send your comments to <a href="mailto:das@aspalliance.com">das@aspalliance.com</a> <a href=../../default.aspx>Back to Article list</a> <br><br> <center><a id="LogoLink" href="http://aspalliance.com"><img src="http://aspalliance.com/libraryaspa/logocounter.asp?article_id=877" border="0" /></a></center> </font></p> </body> </html> I will really appreciate your assistance as I have been battling with this for 2 days and it doesn�t seem that difficult to implement??? THANKS !!
×
×
  • Create New...