调用Web Service的时候提示System.InvalidOperationException: 缺少参数,如何解决
public List<ScanMastEntity> GetCompleteBill(int type, string PADNo, string WhseCode)
{
PDA_ScanMastInfoBLL mastBLL = new PDA_ScanMastInfoBLL();
List<Model.PDA_ScanMastInfoEntity> list = new List<Model.PDA_ScanMastInfoEntity>();
List<ScanMastEntity> scanList=new List<ScanMastEntity>();
SqlParameter[] parameters = {
new SqlParameter("@type", SqlDbType.Int),
new SqlParameter("@PADNo", SqlDbType.VarChar,20),
new SqlParameter("@WhseCode", SqlDbType.VarChar,20)};
parameters[0].Value = type;
parameters[1].Value = PADNo;
parameters[2].Value = WhseCode;
DataSet ds = DbHelperSQL.RunProcedureNoTable("PDA_GetCompBillInfo", parameters);
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
ScanMastEntity entity = new ScanMastEntity();
entity.BillNoVch = dr["BillNoVch"] != null ? dr["BillNoVch"].ToString() : "";
entity.CusBillNoVch = dr["CusBillNoVch"] != null ? dr["CusBillNoVch"].ToString() : "";
entity.BussinessTypeVch = dr["BussinessTypeVch"] != null ? dr["BussinessTypeVch"].ToString() : "";
entity.FeedBackInt = dr["FeedBackInt"] != null ? Convert.ToInt32(dr["FeedBackInt"].ToString()) : 0;
entity.FeedBackVch = dr["FeedBackVch"] != null ? dr["FeedBackVch"].ToString() : "";
entity.UserNameVch = dr["UserNameVch"] != null ? dr["UserNameVch"].ToString() : "";
entity.ReceiveNameVch = dr["ReceiveNameVch"] != null ? dr["ReceiveNameVch"].ToString() : "";
entity.AddDt = Convert.ToDateTime(dr["AddDt"] != null ? dr["AddDt"].ToString() : "");
scanList.Add(entity);
}
}
else
{
scanList = null;
}
return scanList;
}
WebService 运行后 ,三个参数都输入了,点击“调用”,弹出缺少type参数,可我明明输入了2,(存储过程是没有问题的),而且我发现别的方法中只要有int 型的参数都说缺少参数,为什么?如果解决啊?在线等,谢谢了 WebService C#?
[解决办法]
new SqlParameter("@type", SqlDbType.Int),这边传参出问题了,
new SqlParameter("@type", SqlDbType.Int,8)
[解决办法]
你写日志,看具体哪句代码报错
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
[解决办法]