asp.net传值问题传过来的和传过去的ID不一致
问题描述:
labhisid.Text是根据ID传过来的ID号
然后添加数据的时候发现ID不对,是什么回事
比如传值过来的是6,传过去,保存数据的是5
7 5
8 5
正确的应该是是 5 5
6 6
7 7
这怎么解决?
string selmaterials = txtselmaterials.Text;
string hisid1 = labhisid.Text;
DataTable table = BLL.ChangeOverMgr.examaterials(hisid1, selmaterials);
if (table.Rows.Count == 1)
{
DataTable table1 = BLL.ChangeOverMgr.repmaterials(hisid1, selmaterials);
if (table1.Rows.Count == 0)
{
Model.Examaterials examaterials1 = new Model.Examaterials();
try
{
examaterials1.comaterialsid = txtselmaterials.Text;
examaterials1.hisid = this.labhisid.Text.ToString().Trim();
BLL.ChangeOverMgr.getexamaterials(examaterials1);
BLL.ChangeOverMgr.Savaexamaterialshis(examaterials1);
Response.Write("<script>alert('确认成功!');</script>");
}
catch
{
Response.Write("<script>alert('确认失败!');</script>");
}
}
else
{
Response.Write("<script>alert('此已确认,请勿重复确认!');</script>");
}
}
else
{
Response.Write("<script>alert('所输入的数据与表中数据不一致,请检查');</script>");
}
答
不知道你说的5 6 7是什么东西。建议调试下,看看是不是参数搞错了。