procedure OpenEmptyQuery(Query: TADOQuery); var I: Integer; begin with Query do begin if Active then Close; Prepare; for I := 0 to Parameters.Count -1 do Parameters[I].Value := NULL; Open; end; end;
单独写成一个函数啊,也可以放你的FORM里面,例如 type TForm1 = class(TForm private procedure OpenEmptyQuery(Query: TADOQuery); end;implementationprocedure TForm1.OpenEmptyQuery(Query: TADOQuery); var I: Integer; begin with Query do begin if Active then Close; Prepare; for I := 0 to Parameters.Count -1 do Parameters[I].Value := NULL; Open; end; end;要Edit或Append之前调用一下 OpenEmptyQuery(YourQuery); YourQuery.Append;
var
I: Integer;
begin
with Query do
begin
if Active then Close;
Prepare;
for I := 0 to Parameters.Count -1 do
Parameters[I].Value := NULL;
Open;
end;
end;
type TForm1 = class(TForm
private
procedure OpenEmptyQuery(Query: TADOQuery);
end;implementationprocedure TForm1.OpenEmptyQuery(Query: TADOQuery);
var
I: Integer;
begin
with Query do
begin
if Active then Close;
Prepare;
for I := 0 to Parameters.Count -1 do
Parameters[I].Value := NULL;
Open;
end;
end;要Edit或Append之前调用一下
OpenEmptyQuery(YourQuery);
YourQuery.Append;
自已动态建立不就行了.!
比如点查询按钮... adotable.connection:=adoconnection
.......................条件
2.用adoquery的带条件的查询;