function TMaint.NameExist(var name: string): boolean;
begin
result:=false;
with DM do
begin
with query do
begin
Close;
SQL.Clear;
SQL.Add('select * from namelist where username like '''+'%'+name+'%''');
Open;
if dsp.Data='' then//dsp为TDataSetProvider的实例
result:=false else
result:=true;
close;
end;
end;
end;
我是要判断dsp.data是否为空,怎么运行时提示类型转换错误?
begin
result:=false;
with DM do
begin
with query do
begin
Close;
SQL.Clear;
SQL.Add('select * from namelist where username like '''+'%'+name+'%''');
Open;
if dsp.Data='' then//dsp为TDataSetProvider的实例
result:=false else
result:=true;
close;
end;
end;
end;
我是要判断dsp.data是否为空,怎么运行时提示类型转换错误?
begin
result:=false;
with DM do
begin
with query do
begin
Close;
SQL.Clear;
SQL.Add('select * from namelist where username like '''+'%'+name+'%''');
Open;
if dsp.Data=null then//dsp为TDataSetProvider的实例
//或者如下写
//if isEmpty then
//或者
// Result := not isEmpty;
result:=false else
result:=true;
close;
end;
end;
end;