9 个解决方案
#1
快快來呀,各路英雄豪杰.
#2
一般都是先单机开发,然后发布
#3
我該怎樣做?可否講詳細上點?
#4
我只想知道你想去做,你做了没有。回头还要复习复习《小马过河》啦!
单机肯定可以开发三层罗,一般就算是测试也还是可以的。你装了SQL数据库服务器吗?或者其它的也可以,再用RemoteDataModal编一个服务器端,进行,然后再在开发环境中连接,这本就已经构成了三层了。什么只要是没危险,不违法的还是自己试试吧!
单机肯定可以开发三层罗,一般就算是测试也还是可以的。你装了SQL数据库服务器吗?或者其它的也可以,再用RemoteDataModal编一个服务器端,进行,然后再在开发环境中连接,这本就已经构成了三层了。什么只要是没危险,不违法的还是自己试试吧!
#5
当然可以!
一般使用midas技术,服务器端可以使用ADO,连接数据库,客户端看你的需要了。
不过使用midas很讨厌,需要购买许可,我的以前运行的好好的程序,现在爬窝了,不知是否是那个问题,现在正在查。
一般使用midas技术,服务器端可以使用ADO,连接数据库,客户端看你的需要了。
不过使用midas很讨厌,需要购买许可,我的以前运行的好好的程序,现在爬窝了,不知是否是那个问题,现在正在查。
#6
unsigned(僵哥):我看過書,書介紹的不是很詳細,只是一點理論,所以對三層的操作我還是菜鳥,煩請一步一個腳教我,第一......,第二.......
因為我沒有見過三層的結構,所以確實不知道是怎樣的.請幫助.
因為我沒有見過三層的結構,所以確實不知道是怎樣的.請幫助.
#7
当然可以了,一个简单的例子如下:
server:
database<-adoconnaction<-adoquery<-datasetprovider
client:
dcomconnaction<-clientdataset<-datasouce<-dbgrid
server:
unit Unit1;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComServ, ComObj, VCLCom, StdVcl, bdemts, DataBkr, DBClient,
MtsRdm, Mtx, Project1_TLB, Provider, DB, ADODB;
type
Tyxs = class(TMtsDataModule, Iyxs)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
function read(const sqlstr: WideString): OleVariant; safecall;
function write(const sqlstr: WideString): WordBool; safecall;
public
{ Public declarations }
end;
var
yxs: Tyxs;
implementation
{$R *.DFM}
class procedure Tyxs.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
function Tyxs.read(const sqlstr: WideString): OleVariant;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
result:=DataSetProvider1.Data;
except
raise;
end;
end;
function Tyxs.write(const sqlstr: WideString): WordBool;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
if DataSetProvider1.Execute=1 then
result:=true
else
result:=false;
setcomplete;
except
setabort;
raise;
end;
end;
initialization
TComponentFactory.Create(ComServer, Tyxs,
Class_yxs, ciMultiInstance, tmApartment);
end
client:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, DBClient, MConnect;
type
TForm1 = class(TForm)
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DCOMConnection1: TDCOMConnection;
DBGrid1: TDBGrid;
private
{ Private declarations }
procedure getdata ();
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.getdata;
var
sqlstr:string;
begin
sqlstr:='select * from table';
ClientDataSet1.Data:=DCOMConnection1.AppServer.read(sqlstr);
ClientDataSet1.Open;
end;
end.
server:
database<-adoconnaction<-adoquery<-datasetprovider
client:
dcomconnaction<-clientdataset<-datasouce<-dbgrid
server:
unit Unit1;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComServ, ComObj, VCLCom, StdVcl, bdemts, DataBkr, DBClient,
MtsRdm, Mtx, Project1_TLB, Provider, DB, ADODB;
type
Tyxs = class(TMtsDataModule, Iyxs)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
function read(const sqlstr: WideString): OleVariant; safecall;
function write(const sqlstr: WideString): WordBool; safecall;
public
{ Public declarations }
end;
var
yxs: Tyxs;
implementation
{$R *.DFM}
class procedure Tyxs.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
function Tyxs.read(const sqlstr: WideString): OleVariant;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
result:=DataSetProvider1.Data;
except
raise;
end;
end;
function Tyxs.write(const sqlstr: WideString): WordBool;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
if DataSetProvider1.Execute=1 then
result:=true
else
result:=false;
setcomplete;
except
setabort;
raise;
end;
end;
initialization
TComponentFactory.Create(ComServer, Tyxs,
Class_yxs, ciMultiInstance, tmApartment);
end
client:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, DBClient, MConnect;
type
TForm1 = class(TForm)
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DCOMConnection1: TDCOMConnection;
DBGrid1: TDBGrid;
private
{ Private declarations }
procedure getdata ();
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.getdata;
var
sqlstr:string;
begin
sqlstr:='select * from table';
ClientDataSet1.Data:=DCOMConnection1.AppServer.read(sqlstr);
ClientDataSet1.Open;
end;
end.
#8
delphi自己就带了很多,在demos下的midas,自己看
#9
反復研究,的確有心得,好了,多謝眾位的幫助,散分.
#1
快快來呀,各路英雄豪杰.
#2
一般都是先单机开发,然后发布
#3
我該怎樣做?可否講詳細上點?
#4
我只想知道你想去做,你做了没有。回头还要复习复习《小马过河》啦!
单机肯定可以开发三层罗,一般就算是测试也还是可以的。你装了SQL数据库服务器吗?或者其它的也可以,再用RemoteDataModal编一个服务器端,进行,然后再在开发环境中连接,这本就已经构成了三层了。什么只要是没危险,不违法的还是自己试试吧!
单机肯定可以开发三层罗,一般就算是测试也还是可以的。你装了SQL数据库服务器吗?或者其它的也可以,再用RemoteDataModal编一个服务器端,进行,然后再在开发环境中连接,这本就已经构成了三层了。什么只要是没危险,不违法的还是自己试试吧!
#5
当然可以!
一般使用midas技术,服务器端可以使用ADO,连接数据库,客户端看你的需要了。
不过使用midas很讨厌,需要购买许可,我的以前运行的好好的程序,现在爬窝了,不知是否是那个问题,现在正在查。
一般使用midas技术,服务器端可以使用ADO,连接数据库,客户端看你的需要了。
不过使用midas很讨厌,需要购买许可,我的以前运行的好好的程序,现在爬窝了,不知是否是那个问题,现在正在查。
#6
unsigned(僵哥):我看過書,書介紹的不是很詳細,只是一點理論,所以對三層的操作我還是菜鳥,煩請一步一個腳教我,第一......,第二.......
因為我沒有見過三層的結構,所以確實不知道是怎樣的.請幫助.
因為我沒有見過三層的結構,所以確實不知道是怎樣的.請幫助.
#7
当然可以了,一个简单的例子如下:
server:
database<-adoconnaction<-adoquery<-datasetprovider
client:
dcomconnaction<-clientdataset<-datasouce<-dbgrid
server:
unit Unit1;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComServ, ComObj, VCLCom, StdVcl, bdemts, DataBkr, DBClient,
MtsRdm, Mtx, Project1_TLB, Provider, DB, ADODB;
type
Tyxs = class(TMtsDataModule, Iyxs)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
function read(const sqlstr: WideString): OleVariant; safecall;
function write(const sqlstr: WideString): WordBool; safecall;
public
{ Public declarations }
end;
var
yxs: Tyxs;
implementation
{$R *.DFM}
class procedure Tyxs.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
function Tyxs.read(const sqlstr: WideString): OleVariant;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
result:=DataSetProvider1.Data;
except
raise;
end;
end;
function Tyxs.write(const sqlstr: WideString): WordBool;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
if DataSetProvider1.Execute=1 then
result:=true
else
result:=false;
setcomplete;
except
setabort;
raise;
end;
end;
initialization
TComponentFactory.Create(ComServer, Tyxs,
Class_yxs, ciMultiInstance, tmApartment);
end
client:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, DBClient, MConnect;
type
TForm1 = class(TForm)
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DCOMConnection1: TDCOMConnection;
DBGrid1: TDBGrid;
private
{ Private declarations }
procedure getdata ();
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.getdata;
var
sqlstr:string;
begin
sqlstr:='select * from table';
ClientDataSet1.Data:=DCOMConnection1.AppServer.read(sqlstr);
ClientDataSet1.Open;
end;
end.
server:
database<-adoconnaction<-adoquery<-datasetprovider
client:
dcomconnaction<-clientdataset<-datasouce<-dbgrid
server:
unit Unit1;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComServ, ComObj, VCLCom, StdVcl, bdemts, DataBkr, DBClient,
MtsRdm, Mtx, Project1_TLB, Provider, DB, ADODB;
type
Tyxs = class(TMtsDataModule, Iyxs)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
function read(const sqlstr: WideString): OleVariant; safecall;
function write(const sqlstr: WideString): WordBool; safecall;
public
{ Public declarations }
end;
var
yxs: Tyxs;
implementation
{$R *.DFM}
class procedure Tyxs.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
function Tyxs.read(const sqlstr: WideString): OleVariant;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
result:=DataSetProvider1.Data;
except
raise;
end;
end;
function Tyxs.write(const sqlstr: WideString): WordBool;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
try
ADOQuery1.Open;
if DataSetProvider1.Execute=1 then
result:=true
else
result:=false;
setcomplete;
except
setabort;
raise;
end;
end;
initialization
TComponentFactory.Create(ComServer, Tyxs,
Class_yxs, ciMultiInstance, tmApartment);
end
client:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, DBClient, MConnect;
type
TForm1 = class(TForm)
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DCOMConnection1: TDCOMConnection;
DBGrid1: TDBGrid;
private
{ Private declarations }
procedure getdata ();
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.getdata;
var
sqlstr:string;
begin
sqlstr:='select * from table';
ClientDataSet1.Data:=DCOMConnection1.AppServer.read(sqlstr);
ClientDataSet1.Open;
end;
end.
#8
delphi自己就带了很多,在demos下的midas,自己看
#9
反復研究,的確有心得,好了,多謝眾位的幫助,散分.