protected void Button1_Click1(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString); string strimage = @"~\ProductImages\" + FileUpload1.FileName; FileUpload1.PostedFile.SaveAs(Server.MapPath(strimage)); String strInsert = "update SubmitTable set Photo=@Photo where EmailAddress=@EmailAddress"; SqlCommand cmd = new SqlCommand(strInsert, con); SqlParameter Photo = new SqlParameter("@Photo", SqlDbType.NVarChar); Photo.Value = FileUpload1.FileBytes.ToString(); cmd.Parameters.Add(Photo); SqlParameter EmailAddress = new SqlParameter("@EmailAddress", SqlDbType.NVarChar); EmailAddress.Value = Label1.Text.ToString(); cmd.Parameters.Add(EmailAddress); try { con.Open(); cmd.ExecuteNonQuery(); } catch (SqlException ex) { } finally { con.Close(); } Response.Redirect("Update.aspx"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)