After some correction, " p.ProductType = txtName.Text;" the "p" in Presentation layer still got problems. What is the problem? Thanks!
Presentation Layer
You have to write the code under Button:
protected void Button2_Click(object sender, EventArgs e)
{
lblMessage.Visible = true;
p.ProductType = txtName.Text;
if (FileUpload1.PostedFile != null &&
FileUpload1.PostedFile.FileName != "")
{
byte[] imageSize = new byte
[FileUpload1.PostedFile.ContentLength];
HttpPostedFile uploadedImage = FileUpload1.PostedFile;
uploadedImage.InputStream.Read
(imageSize, 0, (int)FileUpload1.PostedFile.ContentLength);
p.Image = imageSize;
}
p.InsertProducts();
lblMessage.Text = "File Uploaded";
}
Business Access Layer
public void InsertProducts()
{
SqlParameter[] p=new SqlParameter[2];
p[0]=new SqlParameter("@ProductType",producttype);
p[0].DbType=DbType.String;
p[1]=new SqlParameter("Image",image);
SqlHelper.ExecuteNonQuery(clsConnection.Connection,