请教下为什么我数据添加到数据库是成功的程序却显示添加失败
谢谢 protected void BtnOK_Click(object sender, EventArgs e)
{
Product SingleProduct = new Product();
SingleProduct.P_ID= TxtNumber.Text;
SingleProduct.P_Color = TxtColor.Text;
SingleProduct.P_Type = DropType.SelectedValue;
SingleProduct.P_Price = TxtPrice.Text;
SingleProduct.P_Show = RadShow.SelectedValue;
SingleProduct.P_Sell = RadSell.SelectedValue;
SingleProduct.P_Picture1 = P_Picture1.Value;
SingleProduct.P_Picture2 = P_Picture2.Value;
SingleProduct.P_Introduce= TxtIntroduce.Text;
if (Product.AddProduct(SingleProduct))//这一段有问题不知道什么原因
{
this.Label2.Text = "产品添加成功! ";
}
else
{
this.Label2.Text = "产品添加失败! ";
}
product.cs
public class Product
{
private int id;
public int ID
{
get { return this.id; }
set { this.id = value; }
}
private string p_id;
public string P_ID
{
get { return this.p_id; }
set { this.p_id = value; }
}
private string p_color;
public string P_Color
{
get { return this.p_color; }
set { this.p_color = value; }
}