如何传参数到TRODataSnapModule中(RemObject方法) |
缺席
|
aKnightChen@Hotmail.com
一般會員 發表:62 回覆:57 積分:23 註冊:2003-06-13 發送簡訊給我 |
以前,我是采用SocketConnect+RemoteDataModule+Midas方法
现在,我想采用RemObject方法, 中间层TRODataSnapModule中,元件有:ADOConnection DataSetProvider AdoQuery 我现在,希望不同用户登录时,可以给不同的CommandTimeOut, 则我必须实现将一个参数(如用户ID)传到TRODataSnapModule,才可以更改CommandTimeOut 我不知道怎么实现传参数传进去? ------ (以前,我是用SocketConnect,我知道,只要在中间层模块中Type Library中定义一个过程,即可实现传参数到RemoteDataModul中。) |
a0
一般會員 發表:11 回覆:29 積分:18 註冊:2003-09-12 發送簡訊給我 |
|
aKnightChen@Hotmail.com
一般會員 發表:62 回覆:57 積分:23 註冊:2003-06-13 發送簡訊給我 |
我研究了一下,不懂如何下手“从客户端传参数到TRORemoteDataModul中".
我贴出源码,望a0有空帮看一下,哪个地方入手。(本人刚开始搞RemObject) Unit1: --------------------------- unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uROClient, uROServer, uROIndyTCPServer, uROIndyHTTPServer, uROBinMessage; type TForm1 = class(TForm) msg_BIN: TROBinMessage; HTTPServer: TROIndyHTTPServer; private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} end. ========================================= Unit2,(RemoteDataModul) ------------- unit Unit2; interface uses {vcl:} SysUtils, Classes, DB, DBClient, {RemObjects:} uRODataSnapModule, Provider, ADODB, uROClient, uROSessions,uROClassFactories,uROClientIntf; type TRODataSnapModule2 = class(TRODataSnapModule) con_SqlServer: TADOConnection; qry_customers: TADOQuery; prv_customers: TDataSetProvider; private { Private declarations } v:boolean; public { Public declarations } end; var RODataSnapModule2: TRODataSnapModule2; implementation uses {RemObjects:} uROServer, uRODataSnap_Invk; {$R *.DFM} procedure Create_DataSnapModule(out oInstance:IUnknown); begin oInstance := TRODataSnapModule2.Create(nil); end; initialization TROClassFactory.Create('IAppServer', Create_DataSnapModule, TAppServer_Invoker); end. **********客户端************** unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DB, DBClient, uROClient, uROBinMessage, uROWinInetHttpChannel, uRODataSnapConnection, Grids, DBGrids; type TForm1 = class(TForm) RODataSnapConnection: TRODataSnapConnection; HTTPChannel: TROWinInetHTTPChannel; ROBinMessage: TROBinMessage; aa: TClientDataSet; Button1: TButton; Memo1: TMemo; DataSource1: TDataSource; DBGrid1: TDBGrid; Button2: TButton; ClientDataSet1: TClientDataSet; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin aa.Close; aa.CommandText:=Memo1.Lines.Text; aa.Open; showmessage('OPEN'); end; procedure TForm1.Button2Click(Sender: TObject); begin aa.Close; aa.CommandText:=Memo1.Lines.Text; aa.Execute; showmessage('EXEC'); end; end.
編輯記錄
aKnightChen@Hotmail.com 重新編輯於 2007-11-20 14:01:57, 註解 無‧
aKnightChen@Hotmail.com 重新編輯於 2007-11-20 14:03:10, 註解 無‧ |
wang_80919
一般會員 發表:0 回覆:1 積分:0 註冊:2008-08-05 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |