there is a table 'Jornal'
id | name | .....| datetime 1 | имя | .....| 10.10.10
Task: select one record in DBgrid, click on the button and a copied string appeared in the database and also in DBgrid with the same values as in the highlighted row
there is a table 'Jornal'
id | name | .....| datetime 1 | имя | .....| 10.10.10
Task: select one record in DBgrid, click on the button and a copied string appeared in the database and also in DBgrid with the same values as in the highlighted row
But here you just have to think and think about simple actions:
... var name:string; dt:TDateTime; ... begin name:=Table1.Fields.FieldByName('name').AsString; // получаем данные dt:=Table1.Fields.FieldByName('datetime').AsDateTime; Table1.Insert; // вставляем их Table1.FieldByName('name').AsString:=name; Table1.FieldByName('datetime'):=dt; Table1.Post;
If the 'ID' field has an AUTO_INCREMENT attribute, then it will take care of itself. All other fields of the table should not have the UNIQUE attribute (uniqueness), otherwise it will lead to an error.
Source: https://ru.stackoverflow.com/questions/112160/
All Articles