1.
with AdoQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from beijing_table where times='''+Edit1.Text+'''');
Open;
if recordcount <>0 then
showmessage('表中有此记录')
else
showmessage('没有此记录!!');
end;
2.
var
ads2:TAdoDataSet;
dsc2:TDataSource;
begin
ads2:=TAdoDataSet.Create(self);
dsc2:=TDataSource.Create(self);
ads2.Prepared:=true;
ads2.Active:=false;
ads2.Connection:=ADOConnection1;
ads2.CommandText:='select * from beijing_table where times='''+Edit1.Text+'''';
ads2.Active:=true;
ads2.Open;
if ads2.RecordCount<>0 then
showmessage('找到了');
else
showmessage('没找到啦');
end;
请大家来比较一下吧,从各个方面..谢喽!!
with AdoQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from beijing_table where times='''+Edit1.Text+'''');
Open;
if recordcount <>0 then
showmessage('表中有此记录')
else
showmessage('没有此记录!!');
end;
2.
var
ads2:TAdoDataSet;
dsc2:TDataSource;
begin
ads2:=TAdoDataSet.Create(self);
dsc2:=TDataSource.Create(self);
ads2.Prepared:=true;
ads2.Active:=false;
ads2.Connection:=ADOConnection1;
ads2.CommandText:='select * from beijing_table where times='''+Edit1.Text+'''';
ads2.Active:=true;
ads2.Open;
if ads2.RecordCount<>0 then
showmessage('找到了');
else
showmessage('没找到啦');
end;
请大家来比较一下吧,从各个方面..谢喽!!
解决方案 »
- 各位大侠帮我看下我的登陆窗口的问题。
- dbgrideh 小问题 !!!
- 调用 Acrobat pdfmaker.dll 实现doc转换pdf(超难!!)问题!!
- 在窗体上动态添加不一定数量的图片,希望窗体改变大小时,图片相应改变长宽大小,怎么做?
- spcomm 的ReceiveData事件不执行
- 诚心求助,delphi源码 传奇登陆器问题
- 为什么总是提示数值溢出啊~~
- 这是不是Delphi 6.0的bug? (关于ADO)
- 我在一个函数中设置返回值 为 TStrings,在调用该 函数时,该变量的COUNT 属性值为 0;
- 求教线程相关问题
- 如何用Delphi启/禁用服务程序,主意不是启动,顺便问下SPI是什么,听说是网络,哪里又有资料那
- [散分]庆祝以后专心灌水
RecordCount<>0 不一定對的,有时有-1,如果把
ads2.Last; ads2.First;在取RecordCount,就不会有-1了
出现-1的条件是含有IMAGE字段
SQL.Add('select count(*) from beijing_table where times='''+Edit1.Text+'''');
如果SQL.Fields[0].asinteger=0就是没记录