I have a dbgrid, I want to copy two columns in it with "Ctl + C" both columns

enter image description here

did so but there is an error before equals (=)

procedure TForm24.mniN2Click(Sender: TObject); begin Clipboard.AsText:=qry2.FieldValues['name_subagent']'+#39+'='+#39+'Clipboard.AsText:=qry3.FieldValues['result']; end; 

[Error] Missing operator or semicolon

did that way but there is a mistake

 Clipboard.AsText:=qry2.FieldValues['name_subagent']+'='+qry2.FieldValues['result']; 

enter image description here

  • If you have a new question, ask it separately. - Kromster

1 answer 1

This is a strange line (apparently, a creature of copy-paste)

  Clipboard.AsText:=qry2.FieldValues['name_subagent']'+#39+'='+#39+'Clipboard.AsText:=qry3.FieldValues['result']; 

The idea should be something like this:

 Clipboard.AsText := qry2.FieldValues['name_subagent']; Clipboard.AsText := Clipboard.AsText + '#39'; //Я так понял #39 это разделитель в строке Clipboard.AsText := Clipboard.AsText + qry3.FieldValues['result']; 

or, in short:

 Clipboard.AsText := qry2.FieldValues['name_subagent'] +'#39'+ qry3.FieldValues['result']; 

Addition Found on the Internet:

It’s not a problem.

In your case, it seems that the Currency does not convert to a string, that is, you must run over the returned Variant from qry3.FieldValues['result'] and convert the values ​​manually, to a string (at the beginning to the list of strings, which then already the whole string, therefore, to add to the first column, which, it seems, was automatically converted to a row).