Y
yanghaijun
Unregistered / Unconfirmed
GUEST, unregistred user!
Delphi7 + RemObjectsV5.0.29.665 + SQL2005 数据库 建立一个简单的三层应用服务器端:建立一个新的应用,在主窗口中放置: TfrmMain = class(TForm) msg_BIN: TROBinMessage;
msg_SOAP: TROSOAPMessage;
HTTPServer: TROIndyHTTPServer;
procedure FormCreate(Sender: TObject);
private { Private declarations } public { Public declarations } end;
...procedure TfrmMain.FormCreate(Sender: TObject);
begin
try HTTPServer.Active:=True;
except On E:Exceptiondo
Application.MessageBox(pchar(E.Message),'错误',MB_OK+MB_ICONERROR);
end;
end;
添加一个 TRODataSnapModule 模块: TRODataSnapModule1 = class(TRODataSnapModule) ADOConnection: TADOConnection;
dspCommon: TDataSetProvider;
ADOQuery: TADOQuery;
procedure ADOConnectionBeforeConnect(Sender: TObject);
private { Private declarations } public { Public declarations } end;
客户端,很简单: TfrmMain = class(TForm) RODataSnapConnection1: TRODataSnapConnection;
ROBinMessage1: TROBinMessage;
DBGrid1: TDBGrid;
ROWinInetHTTPChannel1: TROWinInetHTTPChannel;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
private { Private declarations } public { Public declarations } end;
...procedure TfrmMain.FormCreate(Sender: TObject);
begin
ClientDataSet1.Open;
end;
运行服务端后,再启动客户端,结果服务端会回传一个错误信息到客户端:An exception was rasied on the server: 尚未调用 CoInitialize。该如何解决?
msg_SOAP: TROSOAPMessage;
HTTPServer: TROIndyHTTPServer;
procedure FormCreate(Sender: TObject);
private { Private declarations } public { Public declarations } end;
...procedure TfrmMain.FormCreate(Sender: TObject);
begin
try HTTPServer.Active:=True;
except On E:Exceptiondo
Application.MessageBox(pchar(E.Message),'错误',MB_OK+MB_ICONERROR);
end;
end;
添加一个 TRODataSnapModule 模块: TRODataSnapModule1 = class(TRODataSnapModule) ADOConnection: TADOConnection;
dspCommon: TDataSetProvider;
ADOQuery: TADOQuery;
procedure ADOConnectionBeforeConnect(Sender: TObject);
private { Private declarations } public { Public declarations } end;
客户端,很简单: TfrmMain = class(TForm) RODataSnapConnection1: TRODataSnapConnection;
ROBinMessage1: TROBinMessage;
DBGrid1: TDBGrid;
ROWinInetHTTPChannel1: TROWinInetHTTPChannel;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
private { Private declarations } public { Public declarations } end;
...procedure TfrmMain.FormCreate(Sender: TObject);
begin
ClientDataSet1.Open;
end;
运行服务端后,再启动客户端,结果服务端会回传一个错误信息到客户端:An exception was rasied on the server: 尚未调用 CoInitialize。该如何解决?