2Pascal-新时代的Pascal

标题: 跨进程访问DBGrid.rar [打印本页]

作者: [成都]大悟还俗    时间: 2015-5-5 00:00
标题: 跨进程访问DBGrid.rar
跨进程访问DBGri.rar
作者: bisslot    时间: 2015-5-19 17:55
大虾没看到你说的跨进程访问的过程啊?

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.



作者: bisslot    时间: 2015-5-19 17:55
难道就是CDS 文件吗?




欢迎光临 2Pascal-新时代的Pascal (http://2pascal.com/) Powered by Discuz! X3