Board index » delphi » Delphi Insert Query: Oracle8i backend

Delphi Insert Query: Oracle8i backend

HELP!!!
I can't get this insert statement to work(I get my err msg : Unable to open
database). My select statements work and my direct inserts(using ''sara'' for
myName value instead of a parameter) work and I also set the sql statement
'Delete from cstable' and it worked but I can't get this insert to work. The
dbase backend is Oracle8i and the Name field is a varchar(50): it was a
varchar2(50) but I changed it to see if it would work. I need new EYES(lol).
Any help WOULD BE greatly appreciated! Also, how can I know which conversion
function on the parameters to use betwn Oracle and Delphi...for example I have
datetimepicker objects in my form that I need to send the values to an Oracle
date field: Any code samples? Thanks ever so much!

-------------------------------------------------------------------------------------
try
           DB.AliasName := 'DASAP-MSOFT';
           DB.DatabaseName := 'myMS_ODBC_ORA_DB';
           DB.LoginPrompt := False;
           DB.Params.Values['user name'] := 'audituser';
           DB.Params.Values['password'] := 'selection';

           Q.DatabaseName :=    DB.DatabaseName;

           DS.DataSet := MainFormAddNewPageQuery_Initialize;

           Q.SQL.Clear;

          Q.SQL.Add('INSERT INTO CstabLE(NAME) VALUES(:myName)');

           Q.ParamByName('myName').AsString := 'TestName';

           ShowMessage('The param myName value is: ' + Q.Params[0].Value);

           Q.ExecSQL;

except;
          ShowMessage('Unable to open database.');
end;

------------------------------------------------------------------------------------

--
Posted from  [204.89.69.25]
via Mailgate.ORG Server - http://www.Mailgate.ORG

 

Re:Delphi Insert Query: Oracle8i backend


Where gone "db.connect:=true;" ?

In article <3a6b3cfea1deae70a07f910c70f764a1.46...@mygate.mailgate.org>,
fri...@dor.state.fl.us says...

Quote
> HELP!!!
> I can't get this insert statement to work(I get my err msg : Unable to open
> database). My select statements work and my direct inserts(using ''sara'' for
> myName value instead of a parameter) work and I also set the sql statement
> 'Delete from cstable' and it worked but I can't get this insert to work. The
> dbase backend is Oracle8i and the Name field is a varchar(50): it was a
> varchar2(50) but I changed it to see if it would work. I need new EYES(lol).
> Any help WOULD BE greatly appreciated! Also, how can I know which conversion
> function on the parameters to use betwn Oracle and Delphi...for example I have
> datetimepicker objects in my form that I need to send the values to an Oracle
> date field: Any code samples? Thanks ever so much!

> -------------------------------------------------------------------------------------
> try
>            DB.AliasName := 'DASAP-MSOFT';
>            DB.DatabaseName := 'myMS_ODBC_ORA_DB';
>            DB.LoginPrompt := False;
>            DB.Params.Values['user name'] := 'audituser';
>            DB.Params.Values['password'] := 'selection';

>            Q.DatabaseName :=       DB.DatabaseName;

>            DS.DataSet := MainFormAddNewPageQuery_Initialize;

>            Q.SQL.Clear;

>           Q.SQL.Add('INSERT INTO CstabLE(NAME) VALUES(:myName)');

>            Q.ParamByName('myName').AsString := 'TestName';

>            ShowMessage('The param myName value is: ' + Q.Params[0].Value);

>            Q.ExecSQL;

> except;
>           ShowMessage('Unable to open database.');
> end;

> ------------------------------------------------------------------------------------

--
Best regards,
Emil Beli
http://www.greenhousemm.com

Re:Delphi Insert Query: Oracle8i backend


Hi,

Quote
>           Q.SQL.Add('INSERT INTO CstabLE(NAME) VALUES(:myName)');

Maybe you should change this to:

  Q.SQL.Add('INSERT INTO CstabLE(NAME) VALUES('':myName'')');

Regards
Dirk Mika

Other Threads