C#用ExecuteNonQuery更新数据库程序,为什么返回值一直为0
/////为查询参数赋值,调用更新函数DataSetds=adminmanage.GetAllAdminByName(adminmanage,"tb_admin");st...
/////为查询参数赋值,调用更新函数 DataSet ds = adminmanage.GetAllAdminByName(adminmanage, "tb_admin"); string strAdminID = ds.Tables[0].Rows[0][0].ToString(); purviewmanage.ID = strAdminID; purviewmanage.SysSet = ((CheckBox)(gvAdminPurview.Rows[e.RowIndex].Cells[1].Controls[0])).Checked; purviewmanage.UpdatePurview(purviewmanage);//////更新函数 public int UpdatePurview(PurviewManage purviewmanage) { OleDbParameter[] prams = {data.MakeInParam("@id", OleDbType.VarChar, 50, purviewmanage.ID),data.MakeInParam("@sysset", OleDbType.Boolean,2,purviewmanage.SysSet ),}; return (data.RunProc("update tb_purview set sysset=@sysset where id=@id", prams)); }/////执行更新查询 OleDbCommand cmd = CreateCommand(procName, prams); int t = (int)cmd.ExecuteNonQuery(); if (t == 1) Console.WriteLine("连接成功!"); else Console.WriteLine("连接失败!");
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询