我怎么知道已经搜索到了记录好象用if not mydata.ClientDataSet2.Locate('name',edit1.Text,[loPartialKey]) then
showmessage('没有记录');
这个不行的。而且我怎么知道找到的记录数是多少??

解决方案 »

  1.   

    'select * from table where name='''+edit1.text+'''';
      

  2.   

    你直接用sql 语句查询
    SQL.add('select * from table where name='+''''+edit1.text+'''');得到记录数
    反回的结果,你用
    reccound.
      

  3.   

    ClientDataSet有sql.add吗?我只知道有commandtext。写sql语句那种我会用。但是我想用locate实现。有没有办法???
      

  4.   

    if TClientDataSet.Locate('',VarArrayof[],[]) then
    ////找到了;
    是用来单条记录查找的;可以这样;
    LS_ClinetDataSet.Data := ClientDataSet;
    iCount : Integer;//是一个整形变量,全局
    iCount := 0;
    while ((Not LS_ClientDataSet.Eof) and (V)) do
    begin
      if LS-ClientDataSet.Locate(....) then
      begin
        Delete;
        Inc(LS_Client);
        V := True;
        Next;
      end else
      V := False;
    end;
    ShowMessage(IntToStr(iCount))
      

  5.   

    还是用Command好一些,或是
    TClientDataSet.DataReQuest('..');
    TDataSetProvider....上边的那种效率不一定高;如果你将其都在客户端的话,根本就是效率太低了;