我贴出源码,望大家有空帮看一下(本人刚开始搞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.