I am trying to insert an image into a database table, but after choosing an image, the uploaded image is shown as NULL in the table. Help me to upload image correctly into the database.
Here is my code for inserting data into the database table:
protected void addProduct_Click(object sender, EventArgs e)
{
using (TradersRehmanEntities db = new TradersRehmanEntities())
{
tblProduct ad = new tblProduct();
ad.ProductName = txtProducttName.Text;
ad.ProductPrice = txtSalePrice.Text;
ad.SalePrice = txtSalePrice.Text;
ad.StockAvaliable = txtStock.Text;
ad.CategoriesId = Convert.ToInt32(catergoriesDDL.SelectedValue);
ad.ProductImage = flImageUpload.SaveAs('ProductImage' + flImageUpload.FileName);
db.tblProducts.Add(ad);
db.SaveChanges();
Response.Write("Product added successfully");
}
}