ac1:TAdoConnection; aq1:TAdoQuery;begin aq1.Close; aq1.Connection:=ac1; aq1.Sql.Clear; aq1.Sql.Add('select * from 表名'); aq1.Open; aq1.First; while Not aq1.Eof do begin 列值=aq1.FieldByName('列名').AsString; aq1.Next; end;end;
declare ... ... Select ... endN个步骤可以写在同一句里面,之间加;就可以了 比如说: declare @i int; select @i=field1 from table1 where id=1; select @i i;
aq1:TAdoQuery;begin
aq1.Close;
aq1.Connection:=ac1;
aq1.Sql.Clear;
aq1.Sql.Add('select * from 表名');
aq1.Open;
aq1.First;
while Not aq1.Eof do
begin
列值=aq1.FieldByName('列名').AsString;
aq1.Next;
end;end;
...
...
Select ...
endN个步骤可以写在同一句里面,之间加;就可以了
比如说:
declare @i int; select @i=field1 from table1 where id=1; select @i i;