Upload a picture, insert the name of the picture into the datasheet
protected voidBtnsend_click (Objectsender, EventArgs e) { stringName =txtName.Text; stringPicturename = Fuppicturepath.filename;//Get file name (FileUpload id= "Fuppicturepath") stringDatesend = DateTime.Now.ToString ();//Get current Time//get the suffix name of the uploaded file stringLastName = picturename.substring (Picturename.lastindexof (".") +1); if(Lastname.tolower () = ="jpg"|| Lastname.tolower () = ="BMP"|| Lastname.tolower () = ="gif") { stringSavepath = Server.MapPath ("img/") + Picturename;//Set Save pathFupPicturePath.PostedFile.SaveAs (Savepath);//Save the uploaded picture stringSqlins ="INSERT INTO Tb_picturesend (name,picturename,datesend) VALUES ('"+ Name +"', '"+ Picturename +"', '"+ Datesend +"')"; SqlConnection Con=Createcon (); Con. Open (); SqlCommand com=NewSqlCommand (Sqlins, con); Com. ExecuteNonQuery (); Gvbind (); Con. Close (); } ElseResponse.Write ("<script>alert (' picture format is incorrect!! ') </script>"); }