Rajesh Patel R.P.A Developer | Developer Trainer | Clean Code Evangelist
protected void Button1_Click(object sender, EventArgs e) { SqlCommand comm = new SqlCommand(); byte[] bt; try { comm.CommandText = "sp_tblusers"; comm.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString); comm.CommandType = CommandType.StoredProcedure; int imagelength = FileUpload1.PostedFile.ContentLength; bt = new byte[FileUpload1.PostedFile.ContentLength]; FileUpload1.PostedFile.InputStream.Read(bt, 0, imagelength); comm.Parameters.AddWithValue("@profilePic", bt); comm.Connection.Open(); if (comm.Connection.State == ConnectionState.Open) { if (comm.ExecuteNonQuery() > 0) Response.Write("Image Uploaded"); } } catch (Exception ex) { throw; } }
John Bhatt Glad to Know, Free to Share..... http://www.johnbhatt.com
R D Patel
Login to post response