ADOQuery,ODBC,MDB连接问题
1. ADOQuery -> ODBC -> Access MDB, 刚开始工作正常,一段时间以后(两三分钟后),断开连接,再连接需要10多秒钟。好严重的问题啊.
2. Locate调用没有正确定位, 代码如下
if ADOQuery1.Locate( 'sn ', 'SN100040433 ', [loCaseInsensitive]) then
Memo1.Lines.Add(ADOQuery1.FieldByName( 'sn ').AsString);
if ADOQuery1.Locate( 'sn ', 'SN100020433 ', [loCaseInsensitive]) then
Memo1.Lines.Add(ADOQuery1.FieldByName( 'sn ').AsString);
if ADOQuery1.Locate( 'sn ', 'SN100025433 ', [loCaseInsensitive]) then
Memo1.Lines.Add(ADOQuery1.FieldByName( 'sn ').AsString);
if ADOQuery1.Locate( 'sn ', 'SN100032433 ', [loCaseInsensitive]) then
Memo1.Lines.Add(ADOQuery1.FieldByName( 'sn ').AsString);
if ADOQuery1.Locate( 'sn ', 'SN100037433 ', [loCaseInsensitive]) then
Memo1.Lines.Add(ADOQuery1.FieldByName( 'sn ').AsString);
要定位的记录都是存在的。返回结果如下
SN100040433
SN100035051
SN100035051
SN100035051
SN100037433
我并没有要定位 SN100035051, 但使用AsString得到的结果有三条 SN100035051.
[解决办法]
那就用ADO就可以了!~