localhost.WebService x = new localhost.WebService();סרוויס
if (Session["UserName"]!= null)
{
string UserName = Session["UserName "].ToString();
HiddenField HiddenField1 = (HiddenField)e.Item.FindControl("HiddenField1");
Image y = (Image)e.Item.FindControl("Image1");
int Price = int.Parse(HiddenField1.Value);
int BuyerID = int.Parse(HiddenField1.Value);
x.AddOrder(BuyerID, Price, y.ImageUrl);
}
else
Response.Redirect("Registration.aspx");
[WebMethod]
public void AddOrder(int BuyerID, int Price, int ArtPiece)
{
OleDbDataAdapter x = new OleDbDataAdapter("AddOrder", objConn);
x.SelectCommand.CommandType = CommandType.StoredProcedure;
OleDbParameter objParam = new OleDbParameter("@BuyerID", OleDbType.Char);
objParam.Value = BuyerID;
x.SelectCommand.Parameters.Add(objParam);
objParam = new OleDbParameter("@Price", OleDbType.Char);
objParam.Value = Price;
x.SelectCommand.Parameters.Add(objParam);
objParam = new OleDbParameter("@ArtPiece", OleDbType.Char);
objParam.Value = ArtPiece;
x.SelectCommand.Parameters.Add(objParam);
x.SelectCommand.ExecuteNonQuery();
}
值ArtPiece
是Access文件中的字符串类型。在这一行
x.AddOrder(BuyerID, Price, y.ImageUrl);
y.ImageUrl
显示错误。我该怎么做才能解决它?
答案 0 :(得分:0)
您已将ArtPiece声明为 int :
localhost:2222
我想它应该是:
public void AddOrder(int BuyerID, int Price, int ArtPiece)