Home > Back-end >  Delphi program gridDBGridEh click button to add a blank line, and custom content
Delphi program gridDBGridEh click button to add a blank line, and custom content

Time:09-26

How to use Delphi gridDBGridEh, click on the button to add a line form, not for database operation, only need to display the default information,
Consult a great god

CodePudding user response:

In your new line binding data sources

CodePudding user response:

How is C/S:
 procedure TMID_2_2_Frm. Button3Click (Sender: TObject); 
Var S, SQL, Date1, ID, err: string;
The begin
Date1:=FormatdateTime (' - dd yyyy - MM, DateTimePicker3. Date);
DateTimetoString (ID, 'yymmddhhnnsszzz, now);
SQL:='INSERT INTO parameter _ borrowing credentials (date, ID) VALUES (' +
# 39 + Date1 + # 39 + ', '+
# 39 + ID + # 39 + ');
If DataModule1. SocketConnection1. AppServer. MyQuery (SQL, err)
Then the begin
With DBGridEh1. The DataSource. The DataSet do
The begin
Append.
FieldByName (" date "). AsString:=Date1;
FieldByName (' ID '.) asString:=ID;
Post;
end;
end;
end;

If direct operation database:
 procedure TMID_2_2_Frm. Button3Click (Sender: TObject); 
Var S, SQL, Date1, ID, err: string;
The begin
Date1:=FormatdateTime (' - dd yyyy - MM, DateTimePicker3. Date);
DateTimetoString (ID, 'yymmddhhnnsszzz, now);
With DBGridEh1. The DataSource. The DataSet do
The begin
Append.
FieldByName (" date "). AsString:=Date1;
FieldByName (' ID '.) asString:=ID;
Post;
end;
end;


  • Related