-
Notifications
You must be signed in to change notification settings - Fork 0
/
uFrmChild.pas
87 lines (76 loc) · 1.71 KB
/
uFrmChild.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
unit uFrmChild;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, ADODB, StdCtrls, Buttons, cxGridLevel, cxClasses,
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxGrid,p_dm,p_FrmAdoReconBase, Grids, DBGrids;
type
TfrmChild = class(TfrmAdoReconBase)
btnDataChild: TBitBtn;
qryChild: TADOQuery;
dsChild: TDataSource;
dbgrd1: TDBGrid;
lbl1: TLabel;
procedure btnDataChildClick(Sender: TObject);
private
{ Private declarations }
procedure WMAdoRestore(var message: TMessage); message WM_ADOReCon;
procedure ReadData;
procedure ReadData2;
public
{ Public declarations }
end;
var
frmChild: TfrmChild;
implementation
{$R *.dfm}
procedure TfrmChild.btnDataChildClick(Sender: TObject);
begin
// 如果用ReadData,断线重连后就会报错。
ReadData;
// 如果用ReadData2,断线重连后就没有报错。
// ReadData2;
end;
procedure TfrmChild.ReadData;
begin
with DM_data.qry_pub do
begin
close;
Connection:=DM_data.ado_mydata;
SQL.Text:='SELECT * FROM TBadoChild';
try
Open;
except
end;
end;
dsChild.DataSet:=qryChild;
with qryChild do
begin
close;
SQL.Text:='SELECT * FROM TBadoChild';
try
Open;
except
end;
end;
end;
procedure TfrmChild.ReadData2;
begin
dsChild.DataSet:=qryChild;
with qryChild do
begin
close;
SQL.Text:='SELECT * FROM TBadoChild';
try
Open;
except
end;
end;
end;
procedure TfrmChild.WMAdoRestore(var message: TMessage);
begin
ReadData;
end;
end.