码迷,mamicode.com
首页 > 数据库 > 详细

SQL SERVER获取错误文本信息

时间:2014-09-03 14:44:16      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:style   os   io   strong   ar   for   div   cti   sp   

SQL SERVER获取错误文本信息,BDE、adoquery一直取不到,FDQuery可以了

Some DBMS, like SQL Server, return messages as an additional result set. So, to process messages, the application needs to process multiple result sets. Here is a more complex example, providing status and messages for SQL Server. As you see, we are using TFDMemTable to store result sets with rows.

var
  i: Integer;
begin
  FDConnection1.ResourceOptions.ServerOutput := True;
  FDQuery1.FetchOptions.AutoClose := False;
  FDQuery1.Open(‘select * from Region; print ‘‘Hello‘‘‘);
  FDMemTable1.Data := FDQuery1.Data;
  Memo1.Lines.Add(Format(‘%d rows processed‘, [FDMemTable1.RecordCount]));
  FDQuery1.NextRecordSet;
  if FDConnection1.Messages <> nil then
    for i := 0 to FDConnection1.Messages.ErrorCount - 1 do
      Memo1.Lines.Add(FDConnection1.Messages[i].Message);
end;

SQL SERVER获取错误文本信息

标签:style   os   io   strong   ar   for   div   cti   sp   

原文地址:http://www.cnblogs.com/cb168/p/3953545.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!