FileUpload img = (FileUpload)image; Byte[] imgByte = null; if (img.HasFile && img.PostedFile != null) { HttpPostedFile File = image.PostedFile; imgByte = new Byte[File.ContentLength]; File.InputStream.Read(imgByte, 0, File.ContentLength); } SqlConnection con = new SqlConnection("uid=sa;pwd=123;database=project"); con.Open(); SqlCommand cmd = new SqlCommand("insert into student values('"+regno+"',"+imgByte+")", con);
Byte[] imgByte; SqlCommand cmd = new SqlCommand("insert into student values('"+regno+"',"+imgByte+")", con);
SqlCommand cmd = new SqlCommand("insert into student values(@RegNo,@imgByte)", con); cmd.Parameters.AddWithValue("@RegNo",regno); cmd.Parameters.AddWithValue("@imgByte",imgByte);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)