mostrar imagen en un control de imagen

I need to retrieve the data information from a database and bind the image to an image control not a datagrid or gridview or datalist.

here the code i m using it not working

con.Open()
Dim mycommand As New SqlCommand("SELECT * FROM registration where UserName = @ username", con)
mycommand.Parameters.AddWithValue("@UserName", Session("UserName").ToString())
imgUser.ImageUrl = "UserPics/(image1);
con.close()

y

<asp:Image ID="imgUser" runat="server" Width="340px" Height="150px" ImageUrl="UserPics/<%# Databinder.Eval(container.DataItem, "imagel")  %>.jpg"/>

preguntado el 08 de noviembre de 11 a las 10:11

Your code shouldn't even compile. The ; would have thrown an compilation error on Vb.NET -

no that is just typing mistake -

1 Respuestas

@ username should not have a space =>
- "SELECT * FROM registration where UserName = @username",

; Debe ser un " =>
- imgUser.ImageUrl = "UserPics/(image1)"

Though I'm not sure what that line actually achieves...

respondido 08 nov., 11:15

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.