delphi 用FireDAC获取 SQL SERVER错误文本信息


本文整理自网络,侵删。

 
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;

相关阅读 >>

Delphi中启用禁止cd驱动器自动运行播放

Delphi guid单元

Delphi 判断当前程序是否是活动窗口

在一个exe文件中查找指定内容,找到则返回起始位置,否则返回0

Delphi windows 编程[9] - wm_close 消息

Delphi tmsweb core 刷新当前页面

Delphi searchrec.attr and fadirectory

Delphi dateutils功能详解

Delphi 字幕下载单元subdownload.pas

Delphi 7zip 示例调用7z.dll 压缩及解压.7z文件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...