ado连接,ACCESS查询
sql命令如下,我设置的 EN字段不允许重复,在更新数据库的时候,使用
pRecordset->Open(_variant_t(SqlCmd),_variant_t((IDispatch *)Info.pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
如数据库中没有该记录则添加,有的话就更新该记录的其他字段,
执行两次如下命令的添加或更新操作,第一次数据库中无该记录,正常添加,第二次程序执行时仍旧查询不到该记录,再次添加的时候却因为数据库设置的禁止EN字段重复报错 IDispatch error #3105
如果把该EN字段长度压缩至255或以下执行正常,只要超过255仍旧报错
EN字段设置为 备注格式,索引,禁止重复
求高手指导
select * from sentencetable where EN = '1.fuel rail pressure inspection\n2.Rail pressure monitoring Control variation < 1500/min (rpm)\n3.Rail pressure monitoring Control variation < 1500/min (rpm)\n4.Rail pressure monitoring Control variation > 1500/min (rpm)\n5.Rail pressure monitoring Control variation > 1500/min (rpm)\n6.Rail pressure monitoring Leakage\n7.Rail pressure monitoring Leakage\n8.Rail pressure monitoring The maximum pressure has been exceeded.\n9.Rail pressure monitoring The maximum pressure has been exceeded.\n10.Rail pressure monitoring The pressure control valve jams in the closed position.\n11.Rail pressure monitoring The pressure control valve jams in the closed position.\n12.Rail pressure monitoring The rail pressure cannot be built up.\n13.Rail pressure monitoring The rail pressure cannot be built up.\n14.Rail pressure monitoring The rail pressure is too low.\n15.Rail pressure monitoring The rail pressure is too low.'
------解决方案--------------------ADO操作MDB有一定时间的延迟,你是插入后马上查询?
------解决方案--------------------
第一次执行成功后,关闭程序,再次打开程序,再次执行,同样查询不到该记录。
时间间隔是多久? ADO会有60s时延。
------解决方案--------------------要把Access关了~