就是查询的时候用拉!!
如:我想查询莫一个记录值,但得先判断它是否存在于表中,就得先读一下,就是这样!!
希望各位大侠帮帮小弟得忙..谢谢喽!!

解决方案 »

  1.   

    with AdoQuery1 do
      begin
       Close;
       SQL.Clear;
       SQL.Add('select * from yourtable where 某字段=:xx');
       Parameters[0].Value:=Edit1.Text;
       Open;
       if not IsEmpty then
         //有记录在表中
       else
         //表中没有满足条件的记录
      end;
      

  2.   

    to:smiler007(笑一笑) 
     Parameters[0].Value:=Edit1.Text; 这句是什么意思啊?,求解!!!谢谢
      

  3.   

    第一个参数的值是edit1.text
    意思就是xx的值是edit1.text
      

  4.   

    也可以这样:
    with AdoQuery1 do
      begin
       Close;
       SQL.Clear;
       SQL.Add('select * from yourtable where 某字段=:xx');
       Parameters。Parambyname('xx').Value:=Edit1.Text;
       Open;
       if recordcount <>0  then
         //有记录在表中
       else
         //表中没有满足条件的记录
      end;
      

  5.   

    with AdoQuery1 do
      begin
       Close;
       SQL.Clear;
       SQL.text='select * from yourtable where 字段='xx'';
       Open;
       if recordcount <>0  then
         //有记录在表中
       else
         //表中没有满足条件的记录
      end;
      

  6.   

    with AdoQuery1 do
      begin
       Close;
       SQL.Clear;
       SQL.text='select * from yourtable where 字段='xx'';
       Open;
       if recordcount <>0  then
         //有记录在表中
       else
         //表中没有满足条件的记录
      end;
    -----------------------------------------------------
    楼下的保持队形,呵呵