当我试图插入产品中使用的代码我的DB到:无法隐式转换类型双为int,显式转换存在(是否缺少强制转换?)
private Product CreateProduct()
{
Product product = new Product();
product.Name = txtName.Text; // getting error here (1)
product.Price = Convert.ToDouble(txtPrice.Text); //Getting error here (2)
product.TypeId = Convert.ToInt32(ddlType.SelectedValue);
product.Description = txtDescription.Text;
product.Image = ddlImage.SelectedValue;
return product;
}
我无法修复这个错误。请让我知道我哪里错了。
解决!
请包括更多细节。例如,您应该包含错误消息和导致错误发生的数据。 – ryanyuyu