执行范例:
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;
|
请发表评论