title: How can I save an image to SQL with defined width and height in asp.net c#?
body: <p>I tried to upload an image and save details of the image to SQL. My SQL Table is like this:</p>
  
  <pre>
  Id    FirmId    FileName        FileURL              
  1     12        firmlogo.png    /images/firmlogo.png 
  </pre>
  
  <h2>.aspx:</h2>
  
  <pre><code>&lt;asp:FileUpload ID="FileUpload1" runat="server"/&gt;
  &lt;dx:ASPxButton ID="btnLogo" runat="server" Text="" OnClick="btnLogo_Click"&gt;
  &lt;/dx:ASPxButton&gt;
  </code></pre>
  
  <h2>Code:</h2>
  
  <pre><code>public void SaveImage()
  {
      if (FileUpload1.PostedFile != null)
      {
          string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
          //Save files to disk
          FileUpload1.SaveAs(Server.MapPath("/images/" + FileName));
          //Add Entry to DataBase
          SqlConnection con = new SqlConnection(strConnString);
          string strQuery = "insert into FirmLogo (FileName , FileURL,FirmId) values(@FileName ,@FileURL,@FirmId)";
          SqlCommand cmd = new SqlCommand(strQuery);
          cmd.Parameters.AddWithValue("@FileName ", FileName);
          cmd.Parameters.AddWithValue("@FileURL", "/images/" + FileName);
          cmd.Parameters.AddWithValue("@FirmId", ComboFirm.SelectedItem.Value.ToString());
          cmd.CommandType = CommandType.Text;
          cmd.Connection = con;
  
          try
          {
              con.Open();
              cmd.ExecuteNonQuery();
              Response.Write("&lt;center&gt; &lt;b&gt;Image uploaded.&lt;/b&gt;&lt;/center&gt; ");
          }
          catch (Exception ex)
          {
              Response.Write("&lt;center&gt;&lt;b&gt;Error.Please try again.&lt;/b&gt;&lt;/center&gt; ");
          }
          finally
          {
              con.Close();
              con.Dispose();
          }
      }
  }
  
  protected void btnUpload_Click(object sender, EventArgs e)
  {
      SaveImage();
  }
  </code></pre>
  
  <p>My question: I want image size to be width=300px, height=400px and save to my table like this </p>
  
  <pre>
  Id    FirmId    FileName        FileURL                 Width    Height       
  1     12        firmlogo.png    /images/firmlogo.png    300      400
  </pre>
  
  <p>How can I add  static values  of width and height in my codes?</p>