支付接口返回时用数据库查询是否有这条数据作为判断来插入一系列的数据,但是现在发现数据库还是出现同样的两条甚至多条数据,精确到毫秒插入时间,有的还完全一样,这是什么原因,有什么原因能阻止它同时执行?请各位大神帮忙,我加了延时执行还是不行,。
B_refillRecord refillBLL = new B_refillRecord();
M_refillRecord refillModel = new M_refillRecord();
DataSet dt_refill = new DataSet();
Thread.Sleep(1000);//2015.04.21加入解决重复到账问题
dt_refill = refillBLL.GetList(" temp1='" + BillNo + "' and userName='" + UserName + "'");
if (dt_refill == null || dt_refill.Tables.Count < 1 || dt_refill.Tables[0].Rows.Count < 1) //避免重复到账
{
B_userMoneyInfo umbll = new B_userMoneyInfo();
M_userMoneyInfo ummodel = umbll.GetModel(UserName);
ummodel.accountMoney += (decimal)(double.Parse(Amount));//账户总额
//中间的都省略了**************
CmdList.Add(bll.AddTrans(model));
CmdList.Add(BorrBll.UpdateTrans(BorrInfo));
CmdList.Add(umbll.UpdateTrans(umModel));
CmdList.Add(lmBll.UpdateTrans(lmModel)); //更新投标资金详情表
int tabtr = DbHelperSQL.ExecuteSqlTran(CmdList)
得到的数据的时间,并不是所有都这样,偶尔才这样

2015-04-21 20:59:33.610
2015-04-21 20:59:33.610
2015-04-21 20:59:33.593
2015-04-21 20:59:33.593
2015-04-21 20:59:33.593
------解决思路----------------------
调试一下看看进入了多少次呗
数据库可能存在脏读