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

2022-11-05 14:33:12 作者:admin

本文整理自网络,侵删。

 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研究之驱动开发篇(六)--利用section与用户模式程

Delphi与汇编

Delphi 得到文件创建时间,修改时间,访问时间

Delphi执行sql提示“不正常地定义参数对象”,“提供了不一致或不完整的信息”错误

Delphi 根据特殊符号字符获取字符串前或后的字符

Delphi 双击tmemo选择光标所在行

Delphi pos的用法

Delphi使用spcomm没办法触发receivedata

Delphi 下载一个jpg图片保存为bmp图片

Delphi 的编码与解码(或叫加密与解密)函数

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



在线咨询 拨打电话