COM+中返回_Connection的问题,求助!
New->Activex->Transactional Object
并实现了如下一个函数
function TConnCOM.GetConn: _Connection;
begin
try
fConn := TADOConnection.Create(nil);
with fConn do
begin
ConnectionString := 'Provider=SQLOLEDB.1;'
+'Password=pas;'
+'Persist Security Info=True;'
+'User ID=test;'
+'Initial Catalog=master;'
+'Data Source=10.0.3.202';
LoginPrompt := False;
end;
Result := _Connection(fConn.ConnectionObject);
end;
现在的问题是
我在前台怎么将这个_Connection传给一个TADOQUERY?
我的做法是这样的:
procedure TForm1.Button1Click(Sender: TObject);
var
A : IConnCOM;
begin
A := CoConnCOM.CreateRemote('random');
Showmessage(A.GetConn.ConnectionString); //这个正常
AQ.Connection.ConnectionObject := _Connection(A.GetConn); //这样用出错
AQ.Connection.ConnectionObject := Connection(A.GetConn); //这样用也出错
With AQ do
begin
Close;
SQL.Text := 'Select Count(*) as iCount From syscolumns';
Open;
ShowMessage(FieldByName('iCount').AsString);
end;
end;
错误提示如下:
Access violation at address 0047C43D in module 'APP.exe'. Read of address 00000000
相关推荐
解决 github项目clone报错 Failed connect to github.com:443; Connection
系统环境:CentOS Linux release 7.6.1810 (Core) 起因:npm构建时报错 npm ERR! Error while executing: npm ERR! /usr/bin/git ls-remote -h -t https://github.com/nhn/raphael.git npm ERR! npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': Failed connect to github.com:443; Connection timed out npm
connection 和 preparedstatement 的关闭问题
什么时候用statement,什么时候用preparedstatement
NET Delegate Event Model vs COM Connection PointsNET事件模型
NET Delegate Event Model vs COM Connection PointsNET事件模型和COM连接点
mac 安装homebrew出错 Failed to connect to raw.githubusercontent.com port 443: Connection refused error:
折腾了好久,执行 /usr/bin/ruby -e $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) 开始一直报错Failed to connect to raw.githubusercontent.com port 443: Connection refused error: Error: 7, 尝试过改动git config的代理,没有用, 换中科大的源,也没有用 最后解决办法如下,重装command line tools,再执行安装指令,homebrew安装成功。 remo
如何从COM返回断开的ADO记录集
有关如何使用VC从COM返回断开连接的ADO Recordset的文章


网络通信/分布式开发
