C#事务 此sqltransaction已完成,他再也无法使用
using(dr=com.ExecuteReader()){if(dr.HasRows){while(dr.Read()){A_kckc=newA_kc();kc.Kcs...
using (dr = com.ExecuteReader())
{
if (dr.HasRows)
{
while (dr.Read())
{
A_kc kc = new A_kc();
kc.Kcsl = Convert.ToDecimal(dr["kcsl"]);
decimal zkc = list[i].Kcsl + kc.Kcsl;
com.CommandText = "update_hebingkucun";
SqlParameter[] paras3 = {
new SqlParameter("@dnm",dnm),
new SqlParameter("@kfbm",list[i].Kfbm),
new SqlParameter("@kcsl",zkc),
};
com.Parameters.Clear();
com.Parameters.AddRange(paras3);
result = com.ExecuteNonQuery() > 0;
}
}
} 展开
{
if (dr.HasRows)
{
while (dr.Read())
{
A_kc kc = new A_kc();
kc.Kcsl = Convert.ToDecimal(dr["kcsl"]);
decimal zkc = list[i].Kcsl + kc.Kcsl;
com.CommandText = "update_hebingkucun";
SqlParameter[] paras3 = {
new SqlParameter("@dnm",dnm),
new SqlParameter("@kfbm",list[i].Kfbm),
new SqlParameter("@kcsl",zkc),
};
com.Parameters.Clear();
com.Parameters.AddRange(paras3);
result = com.ExecuteNonQuery() > 0;
}
}
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询