Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread insert variable value into a table
Fri, Dec 25 2009 11:55 AMPermanent Link

Paul Waegemans
I want to insert an variable value (totaaluitgaven) into a table:

.
.
totaaluitgaven:=TblAbc.Totaal.value;

sql.Add('INSERT INTO rapport values('' '','' '',totaaluitgaven) ')

see errormessage in attachment


Thanks.



Attachments: foutmelding.jpg
Fri, Dec 25 2009 5:14 PMPermanent Link

Steve Forbes

Team Elevate Team Elevate

Hi Paul,

Assuming that the column in the table you are inserting into is called
"totaaluitgaven", the column type is Double, the table is called
"Waegemans", and that there are no (other) required columns you could
use the following SQL statement:

INSERT INTO Waegemans (totaaluitgaven) VALUES (:value);

The :value placeholder is a parameter which can be substituted with a
value when the SQL statement is executed i.e.

with Query do
begin
  SQL := 'INSERT INTO Waegemans (totaaluitgaven) VALUES (:value);'
  ParamByName('value').AsFloat := 10.15;
  ExecSQL;
end;

Hope this helps

Best regards

Steve



Paul Waegemans wrote:
> I want to insert an variable value (totaaluitgaven) into a table:
>
> .
Sun, Dec 27 2009 4:29 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Paul

>I want to insert an variable value (totaaluitgaven) into a table:

On the minimal information given I assume you mean using SQL so

INSERT INTO tablename (fieldname) VALUES(:Value)

and supply Value as a parameter to the query

If that's not what you want please let us have some more details

Roy Lambert [Team Elevate]
Sun, Dec 27 2009 4:28 PMPermanent Link

Paul Waegemans
tHIS IS PERFECT!

Steve Forbes wrote:

Hi Paul,

Assuming that the column in the table you are inserting into is called
"totaaluitgaven", the column type is Double, the table is called
"Waegemans", and that there are no (other) required columns you could
use the following SQL statement:

INSERT INTO Waegemans (totaaluitgaven) VALUES (:value);

The :value placeholder is a parameter which can be substituted with a
value when the SQL statement is executed i.e.

with Query do
begin
  SQL := 'INSERT INTO Waegemans (totaaluitgaven) VALUES (:value);'
  ParamByName('value').AsFloat := 10.15;
  ExecSQL;
end;

Hope this helps

Best regards

Steve



Paul Waegemans wrote:
> I want to insert an variable value (totaaluitgaven) into a table:
>
> .
Image