Note that there are some explanatory texts on larger screens.

plurals
  1. POresizeing image . . . .
    primarykey
    data
    text
    <p>hi thanks a lot i have one code below in this code ill upload one image . convert it into byte code and store it in database .. and retrive it in gridview .. the thing is before converting it into byte code i want to resize it could u plz tell me what code i should insert here ... thanks a lot .. ... </p> <pre><code>protected void btnUpload_Click(object sender, EventArgs e) { string strID= txtid.Text.ToString(); string strImageName = txtName.Text.ToString(); if (FileUpload1.PostedFile != null &amp;&amp; FileUpload1.PostedFile.FileName != "") { byte[] imageSize = new byte [FileUpload1.PostedFile.ContentLength]; HttpPostedFile uploadedImage = FileUpload1.PostedFile; uploadedImage.InputStream.Read (imageSize, 0, (int)FileUpload1.PostedFile.ContentLength); // Create SQL Connection SqlConnection con = new SqlConnection("user id=sa;password=Zoomin@123;database=salary_db;server=192.168.1.100"); // Create SQL Command SqlCommand cmd = new SqlCommand(); cmd.CommandText = "INSERT INTO image1(ID,ImageName,Image)" + " VALUES (@ID,@ImageName,@Image)"; cmd.CommandType = CommandType.Text; cmd.Connection = con; SqlParameter ID = new SqlParameter ("@ID", SqlDbType.VarChar, 50); ID.Value = strID.ToString(); cmd.Parameters.Add(ID); SqlParameter ImageName = new SqlParameter ("@ImageName", SqlDbType.VarChar, 50); ImageName.Value = strImageName.ToString(); cmd.Parameters.Add(ImageName); SqlParameter UploadedImage = new SqlParameter ("@Image", SqlDbType.Image, imageSize.Length); UploadedImage.Value = imageSize; cmd.Parameters.Add(UploadedImage); con.Open(); int result = cmd.ExecuteNonQuery(); con.Close(); if (result &gt; 0) lblMessage.Text = "File Uploaded"; GridView1.DataBind(); }} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload