i




Closed 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Asp.net how to retrieve the saved images & details in datalist
11-26-2010, 08:01 PM (This post was last modified: 11-27-2010 04:33 PM by dn2010.)
Post: #1
Not Solved how to retrieve the saved images & details in datalist
hi friends,

how to insert date,rid,Name,imgData(selected image from IMAGE BUTTON CONTROL),imgType,imgLength in database.

and

how to retrieve the saved images & details in datalist / gridview.

***************************************************
protected void btnvote_Click(object sender, EventArgs e)
{
FileInfo fInfo = new FileInfo(Server.MapPath(imgbtn.ImageUrl.ToString()));
FileStream fs = new FileStream(Server.MapPath(imgbtn.ImageUrl.ToString()), FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
Byte[] imgbytes = br.ReadBytes((int)fInfo.Length);

OpenConnection(con);
cmd.Connection = con;

cmd.CommandText = "INSERT INTO vote (Name,imgData) Values(@Name,@imgData)";// ('" + "suresh" + "','" + imgbytes + "')";
cmd.Parameters.AddWithValue("@Name", txtname.Text.Trim());
cmd.Parameters.AddWithValue("@imgData",(object)imgbytes);


cmd.ExecuteNonQuery();
con.Close();
}

please give the code.

thanks





Thanks & Regards,
11-27-2010, 12:28 AM
Post: #2
Not Solved RE: Insert code
this must be helpful to you check this
http://www.codeproject.com/Articles/1264...P-NET.aspx


Two Busy Days..

Thanks and Regards
Raju.M
11-27-2010, 06:48 AM
Post: #3
Not Solved RE: Insert code
it is better if you insert the image path in database instead of byte conversion. this step will remove your insertion and retrieval difficulties.


[Image: 2604595733.png]
11-27-2010, 02:08 PM
Post: #4
Not Solved RE: Insert code
thanks your response,

but your example is used in fileupload control.

my requirement isif click datalist to(selected Image) Imagebutton control to save database
& retrive from images in datalist.

thanks.


Thanks & Regards,
Closed 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
  In convert pdf to images.How to increase quality of images.Any one can tell me please mahaveer 4 524 07-05-2013 06:31 AM
Last Post: magnum_2007
  Gridview vs DataList vs Repeater ASP.NET kbsrinivas.07@gmail.com 1 430 04-05-2013 05:35 AM
Last Post: magnum_2007
  Best way to retrieve data from sql server praveen 2 812 12-03-2012 01:05 PM
Last Post: praveen
  Can save images to a structured text file C# ? dongtrien 1 809 11-22-2012 04:54 AM
Last Post: nisar87
  Find textbox value in row details template in datagrid gopal_nivas 0 855 10-09-2012 05:09 AM
Last Post: gopal_nivas



User(s) browsing this thread: 1 Guest(s)