Click here to Skip to main content
15,878,852 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..
C#
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>

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

C#
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 1:58am
v3

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

 

2.

 string ImageUrl = "";

 
3.

ImageUrl = lblImage.ImageUrl;
 
Share this answer
 
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[^]
 
Share this answer
 
v2
1.
C#
lblImage.ImageUrl = dt.Rows[0]["ImageUrl"].ToString();



2.
string ImageUrl = "";


3.
C#
ImageUrl = lblImage.ImageUrl;
 
Share this answer
 

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