Hello All,
Am new to delphi and I do hope u can all help with my problem.
I need to insert a record into a table based on a certain where clause. I have written the following code:
with dm.Dset do
begin
commandText := 'Insert into tblDeductions' +
'(deductid' +
',empid' +
',DeductType' +
',deductAmt)' +
'Values( ' + txtdeductID.Text + '' +
', ' + '''' + frmPayroll.txtEmpID.Text + '''' +
', ' + '''' + txtDescription.Text + '''' +
', ' + txtAllowanceAmt.Text + '' +
' where empid = ' + frmPayroll.txtEmpID.Text + ')' ;
connection.Execute(dm.Dset.CommandText);
end;
It comes with the ff error :Syntax error(missing operator) in query expression '400 where empid =001". Process stopped.
2. There are other fields to inserted but the error is only showing 400 and 001 from the other editboxes.
3. Where can I learn about paramterized queries. I tried reading it?
Thanks all.
wiredX
Am new to delphi and I do hope u can all help with my problem.
I need to insert a record into a table based on a certain where clause. I have written the following code:
with dm.Dset do
begin
commandText := 'Insert into tblDeductions' +
'(deductid' +
',empid' +
',DeductType' +
',deductAmt)' +
'Values( ' + txtdeductID.Text + '' +
', ' + '''' + frmPayroll.txtEmpID.Text + '''' +
', ' + '''' + txtDescription.Text + '''' +
', ' + txtAllowanceAmt.Text + '' +
' where empid = ' + frmPayroll.txtEmpID.Text + ')' ;
connection.Execute(dm.Dset.CommandText);
end;
It comes with the ff error :Syntax error(missing operator) in query expression '400 where empid =001". Process stopped.
2. There are other fields to inserted but the error is only showing 400 and 001 from the other editboxes.
3. Where can I learn about paramterized queries. I tried reading it?
Thanks all.
wiredX