DataTable dt = new DataTable(); string strimage, path; strimage = fileuploadstphoto.FileName; path = Server.MapPath("~/newseventphoto/"); if (!txtmod.Text.Equals("")) { if (!fileuploadstphoto.FileName.Equals("")) { fileuploadstphoto.PostedFile.SaveAs(path + fileuploadstphoto.FileName); txtimage.Text = fileuploadstphoto.FileName; } // if you don't want update image and only update the data use stored procedure for update if (obj1.updatenews(Convert.ToInt16(txtmod.Text), ddrnews.SelectedValue.ToString(), txtnewstitle.Text.Replace("'", "''").ToString(), FCKeditor1.Value.Replace("'", "''"), txtimage.Text, Session["adminid"].ToString())) { txtnewstitle.Text = ""; FCKeditor1.Value = ""; txtimage.Text = ""; errormsg.InnerText = "Record update Successfully"; } else { errormsg.InnerText = "Record update Inserted Try Again"; } } else { if (!fileuploadstphoto.FileName.Equals("")) { fileuploadstphoto.PostedFile.SaveAs(path + fileuploadstphoto.FileName); txtimage.Text = fileuploadstphoto.FileName; } else { txtimage.Text = "noimage.gif"; } // use here stored Procedure or query For insert the data if (obj1.insertnews(ddrnews.SelectedValue.ToString(), txtnewstitle.Text.Replace("'", "''").ToString(), FCKeditor1.Value.Replace("'", "''"), txtimage.Text, Session["adminid"].ToString(), Session["adminid"].ToString())) { txtnewstitle.Text = ""; FCKeditor1.Value = ""; txtimage.Text = ""; errormsg.InnerText = "Record Add Successfully"; } else { errormsg.InnerText = "Record Not Inserted Try Again"; } } } catch (Exception ex) { Response.Write(ex.Message); }
Monday, March 22, 2010
Code for upload the image and add into database
Code for upload the image using Fileupload This function
save the image in the server Folder path specify In server.map
path Save the image name into tabel.
-
The following article discusses the WPF command binding feature with relation to Mouse clicks. One of WPF powerful features is the bindin...
-
SQL Server has never been short of ways to read from and write to files and it is always better to use the standard techniques provided b...
-
In this article we will look at the basics of Angular.Js. This is the first part of an article series. The main objective of this series i...