 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Arquimides Guest
|
Posted: Thu Jul 20, 2006 5:17 am Post subject: Easy Question D2006 SQL with Params |
|
|
Hi, I'm trying to do an insert with Parameters but the values are not
inserted on the SQL Statement maybe is an easy error but I didn't found it.
Here is the code
SQLAddInv.SQL.Clear;
SQLAddInv.SQL.Add('INSERT INTO customers (custkey,custname,addr1)');
SQLAddInv.SQL.Add('VALUES (:Custkey, :CustName, :addr1)');
SQLAddInv.ParamByName('Custkey').Value := Vcustkey;
SQLAddInv.ParamByName('CustName').Value := VCustname;
SQLAddInv.ParamByName('addr1').Value := Vaddr1;
SQLAddInv.SQL.SaveToFile('C:\rbs\Invadd.sql');
try
SQLAddInv.ExecSQL(True); |
|
| Back to top |
|
 |
Dan Palley Guest
|
Posted: Thu Jul 20, 2006 8:21 pm Post subject: Re: Easy Question D2006 SQL with Params |
|
|
"Arquimides" <arquimedes (AT) science (DOT) net> wrote in message
news:44beca42$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi, I'm trying to do an insert with Parameters but the values are not
inserted on the SQL Statement maybe is an easy error but I didn't found
it.
Here is the code
SQLAddInv.SQL.Clear;
SQLAddInv.SQL.Add('INSERT INTO customers (custkey,custname,addr1)');
SQLAddInv.SQL.Add('VALUES (:Custkey, :CustName, :addr1)');
SQLAddInv.ParamByName('Custkey').Value := Vcustkey;
SQLAddInv.ParamByName('CustName').Value := VCustname;
SQLAddInv.ParamByName('addr1').Value := Vaddr1;
SQLAddInv.SQL.SaveToFile('C:\rbs\Invadd.sql');
try
SQLAddInv.ExecSQL(True);
|
The params won't be saved to the file with the SQL statement -- they're
replaced at execute time by the SQL engine. Are you seeing an error
somewhere?
Dan |
|
| Back to top |
|
 |
Robert Guest
|
Posted: Mon Jul 24, 2006 8:10 am Post subject: Re: Easy Question D2006 SQL with Params |
|
|
You have not given the parameters a type.
I have always found this to be essential.
ie.
TParam.Datatype = ftString;
Regards,
Robert.
"Dan Palley" <dan (AT) trams (DOT) com> wrote in message
news:44bf9ff2$1 (AT) newsgroups (DOT) borland.com...
| Quote: | "Arquimides" <arquimedes (AT) science (DOT) net> wrote in message
news:44beca42$1 (AT) newsgroups (DOT) borland.com...
Hi, I'm trying to do an insert with Parameters but the values are not
inserted on the SQL Statement maybe is an easy error but I didn't found
it.
Here is the code
SQLAddInv.SQL.Clear;
SQLAddInv.SQL.Add('INSERT INTO customers (custkey,custname,addr1)');
SQLAddInv.SQL.Add('VALUES (:Custkey, :CustName, :addr1)');
SQLAddInv.ParamByName('Custkey').Value := Vcustkey;
SQLAddInv.ParamByName('CustName').Value := VCustname;
SQLAddInv.ParamByName('addr1').Value := Vaddr1;
SQLAddInv.SQL.SaveToFile('C:\rbs\Invadd.sql');
try
SQLAddInv.ExecSQL(True);
The params won't be saved to the file with the SQL statement -- they're
replaced at execute time by the SQL engine. Are you seeing an error
somewhere?
Dan
|
|
|
| Back to top |
|
 |
Dmitry Arefiev Guest
|
Posted: Wed Jul 26, 2006 4:14 pm Post subject: Re: Easy Question D2006 SQL with Params |
|
|
Hello !
| Quote: | You have not given the parameters a type.
I have always found this to be essential.
|
No, that is not required. Because, first assign of
parameter value will implicitly set parameter type
according to the assigned value type.
Regards,
Dmitry
--
Dmitry Arefiev - www.da-soft.com
AnyDAC - Oracle, MySQL, MSSQL, MSAccess, IBM DB2, Sybase
ASA, DbExpress, ODBC freeware data access framework
gs-soft AG - www.gs-soft.com
SAPx - Delphi to SAP R/3 direct access
Saphir - SAP R/3 metadata at your fingertips
MetaBase - ERWIN model in Delphi applications |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|