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 android 拨打电话

建议大家使用fastmm

Delphi now、date、time、currentyear - 当前日期

Delphi xe 提权代码

Delphi之声音资源(*.res)的编译方法

Delphi强制应用非一次性载入的注册表设置

Delphi 判断进程名是否存在,如果存在则结束进程

Delphi tclientdataset用法详解

Delphi types of actual and formal var parameters must be identical

Delphi 中使用dialog api

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



打赏

取消

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

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

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

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

评论

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