|
大虾没看到你说的跨进程访问的过程啊?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Grids, DBGrids, ADODB, DBClient;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
con1: TADOConnection;
qry1: TADOQuery;
dbgrd1: TDBGrid;
ds1: TDataSource;
btn1: TButton;
ClientDataSet1: TClientDataSet;
procedure btn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation//程序出处:http://pan.baidu.com/s/1GFZuZ
{$R *.dfm} //为测试方便,我将数据换为orders.cds
//windows7 + delphi7 测试通过. 广州佬
procedure TForm1.btn1Click(Sender: TObject);
begin
{
with qry1 do
begin
close;
sql.Clear;
sql.Text:='select * from orders';
open;
end;
}
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//一下代码是我加:
ClientDataSet1.FileName:=ExtractFilePath (ParamStr(0))+'orders.cds';
ClientDataSet1.Open;
ds1.DataSet:=ClientDataSet1;
Caption:='被访问目标程序';
end;
end.
|
|