unit MainForm;
interface
uses
Business.System, Business.Model, Business.Forms, Business.Data;
type
TMainForm = class(TForm)
FuncBroker: TFuncBroker;
InfoBrokerZCXX: TInfoBroker;
ControlBar: TControlBar;
DataNavigator: TDataNavigator;
DocViewBar: TDocViewBar;
Panel: TPanel;
Splitter: TSplitter;
DocViewZCXX_ZWG: TDocView;
DocViewZCXX_CWG: TDocView;
Button1: TButton;
mDataSet: TDataSetBroker;
dDataSet: TDataSetBroker;
Query1: TQuery;
procedure Button1Click(Sender: TObject);
procedure mDataSetAfterOpen(DataSet: TDataSet);
procedure mDataSetAfterScroll(DataSet: TDataSet);
procedure BizFormShow(Sender: TObject);
private
{private declarations}
public
{public declarations}
end;
implementation
procedure TMainForm.Button1Click(Sender: TObject);
var
lStr,lID,lNAME: String;
begin
lID := Business.System.JSCommon.CreateGUIDStr;
lStr := mDataSet.DataSet.FieldByName('ID').AsString;
Query1.Close;
Query1.CommandText := 'Select * from SJB11 Where ID='''+ lStr+'''';
Query1.open;
while not Query1.eof do
begin
dDataSet.DataSet.Append;
dDataSet.DataSet.FieldByName('ZD2').AsString := Query1.FieldByName('ZD2').AsString;
dDataSet.DataSet.FieldByName('ZD3').AsString := Query1.FieldByName('ZD3').AsString;
dDataSet.DataSet.FieldByName('ID').AsString := lID;
dDataSet.DataSet.post;
Query1.Next;
end;
lNAME := mDataSet.DataSet.FieldByName('NAME').AsString;
mDataSet.DataSet.InsertRecord([lID,lNAME]);
dDataSet.DataSet.ApplyUpdates;
mDataSet.DataSet.ApplyUpdates;
mDataSetAfterScroll(mDataSet.DataSet);
end;
procedure TMainForm.mDataSetAfterOpen(DataSet: TDataSet);
begin
TSqlDataSet(dDataSet.DataSet).SQL.Text := 'select * from SJB11 Where ID ='''+ mDataSet.DataSet.FieldByName('ID').AsString+ '''';
dDataSet.DataSet.open;
end;
procedure TMainForm.mDataSetAfterScroll(DataSet: TDataSet);
begin
dDataSet.DataSet.Close;
TSqlDataSet(dDataSet.DataSet).SQL.Text := 'select * from SJB11 Where ID ='''+ mDataSet.DataSet.FieldByName('ID').AsString+ '''';
//dialogs.ShowMessage(TSqlDataSet(dDataSet.DataSet).SQL.Text);
dDataSet.DataSet.open;
end;
procedure TMainForm.BizFormShow(Sender: TObject);
begin
mDataSet.DataSet.open;
end;
end.
这是功能上的所有代码,其他地方没有写任何代码 |