Click here to Skip to main content
14,732,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi can any one solve my problem.....
please just check my declaration is in correct format or not..
if (dt.Rows.Count > 0)
       {
           lblPrice.Text = dt.Rows[0]["Price"].ToString();
           ImageUrl.ImageUrl = dt.Rows[0]["ImageUrl"].ToString();
       }

dis is Design Source Code
<asp:Image ID="ImageUrl" runat="server" ImageUrl='<%#Eval("ImageUrl") %>'></asp:Image>

protected void Button1_Click(object sender, EventArgs e)
   {
        string Price = "";
        Image ImageUrl = "";//is this in correct format
   }

Price = lblPrice.Text;
ImageUrl = ImageUrl;//how to write code here//

SqlParameter paraImageUrl = new SqlParameter("@ImageUrl", SqlDbType.VarChar,50);
paraImageUrl.Value = ImageUrl;
cmd.Parameters.Add(paraImageUrl);
Posted
Updated 6-Jan-12 2:58am
v3

lblImage.ImageUrl = dt.Rows[0]["ImageUrl"].ToString();

 

2.

 string ImageUrl = "";

 
3.

ImageUrl = lblImage.ImageUrl;
   
v2
The images are stored in database are in binary format and retrive with their respective content type.
Here are some useful links that helps you to store and retrive images from database.

how to store and fetch images from SQL server[^]

store images in sqlserver[^]

Save and Read Image Database[^]
   
v2
1.
lblImage.ImageUrl = dt.Rows[0]["ImageUrl"].ToString();



2.
string ImageUrl = "";


3.
ImageUrl = lblImage.ImageUrl;
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900