Delphi가 프로그램에서 SQL 문장을 맞추어 결과를 얻습니다

4056 단어 Delphi
실행 예:
 
 1 var
2 Qry:TAdoQuery;
3 singleRecord,Response:string;
4 begin
5 Context.Response:='';
6 Qry:=TAdoQuery.Create(nil);
7 try
8 try
9 Qry.Connection:=Context.Cn;
10 Qry.Close;
11 Qry.SQL.Clear;
12 Qry.SQL.Add('select * from wmnow..code');
13 Qry.Open;
14 while not Qry.Eof do
15 begin
16 singleRecord:=Qry.FieldByName('i_unit').AsString+';'+Qry.FieldByName('v_unit').AsString+';'
17 +Qry.FieldByName('i_dot').AsString;
18 Response:=Response+singleRecord+'|';
19 Qry.Next;
20 end;
21 SetLength(Response,Length(Response)-1);
22 except
23 on E:Exception do
24 begin
25 MainForm.MemoPrint(' , ');
26 end;
27 end
28 finally
29 Qry.Free;
30 end;
31 Context.Response:=Response;
32 end;

좋은 웹페이지 즐겨찾기