求教
采用的是Oracle数据库,简单的三层架构,在页面的调用上没有问题,运行不报错。
但删除时ID的传值是正确的。可不能删除指定ID的信息,而是全部删除了。请问为什么呀?
知道的告诉我一下,十分感谢!
public void DeleteLaborRight(int ID) //数据层
{
string storePrc = "laboringinspect_packagebody.DeleteLaborRight";
OracleParameter[] param =
{
new OracleParameter("ID", OracleType.Int32 )
};
param[0].Value = ID;
try
{
OracleHelper.ExecuteNonQuery(OracleHelper.connectionStr, CommandType.StoredProcedure, storePrc, param);
}
catch (Exception ex)
{
throw new ApplicationException(ex.Message);
}
}
public void DeleteLaborRight(int ID) //业务层
{
LaborPeccancy.DeleteLaborRight(ID);
}
if (e.CommandArgument == "DeleteP") //用户层
{
PeccancyPrompt.DeleteLaborRight(Convert.ToInt32(PeccancyID.Text));
BindGridview();
}procedure DeleteLaborRight //存储过程
(
Id int
)
as
begin
delete from "LaborRight" where "LaborRight"."ID"=Id;
end DeleteLaborRight;
采用的是Oracle数据库,简单的三层架构,在页面的调用上没有问题,运行不报错。
但删除时ID的传值是正确的。可不能删除指定ID的信息,而是全部删除了。请问为什么呀?
知道的告诉我一下,十分感谢!
public void DeleteLaborRight(int ID) //数据层
{
string storePrc = "laboringinspect_packagebody.DeleteLaborRight";
OracleParameter[] param =
{
new OracleParameter("ID", OracleType.Int32 )
};
param[0].Value = ID;
try
{
OracleHelper.ExecuteNonQuery(OracleHelper.connectionStr, CommandType.StoredProcedure, storePrc, param);
}
catch (Exception ex)
{
throw new ApplicationException(ex.Message);
}
}
public void DeleteLaborRight(int ID) //业务层
{
LaborPeccancy.DeleteLaborRight(ID);
}
if (e.CommandArgument == "DeleteP") //用户层
{
PeccancyPrompt.DeleteLaborRight(Convert.ToInt32(PeccancyID.Text));
BindGridview();
}procedure DeleteLaborRight //存储过程
(
Id int
)
as
begin
delete from "LaborRight" where "LaborRight"."ID"=Id;
end DeleteLaborRight;
传入参数命名问题,不能与列名重复,id改成i_id即可
相同的时候,程序会理解成
where id=id //始终真,而不是你希望的变量