🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
2 messages
2 total messages Started by pascal Fri, 10 Oct 2003 07:20
Problem with TDatabase and TParams
#27
Author: pascal
Date: Fri, 10 Oct 2003 07:20
28 lines
1693 bytes
Hi,

I've got problem with TDatabase et TParams.

In this code

   TParams *Params = new TParams();
   hDBICur Cursor;

try {
   Params->CreateParam(ftString, "Pr_Code", ptInput);
   Params->CreateParam(ftString, "Pr_Caption", ptInput);
   Params->Items[0]->AsString=AnsiString(Code);
   Params->Items[1]->AsString=Pr_Caption->Text;
   SqlCmd="Insert into Project (Pr_Code,Pr_Caption,Pr_BgImage) Values
           (:Pr_Code,:Pr_Caption,'N')";
    DbMkt->Execute(SqlCmd,Param,false,&Cursor);
   } __finally {
     delete Params;
   }


He says 'I dont find the object' !
Why ?

And how can I use hDBICur

Thank's
Re: Problem with TDatabase and TParams
#36
Author: Romulo
Date: Sun, 07 Dec 2003 02:20
59 lines
2634 bytes
Hi pascal!.
try this....: (it's very more easy)
//--------------------------------------------------------------------------
-----
     DMVentas->DBVentas->StartTransaction();
     TQuery* q = new TQuery();
     q->DatabaseName = DMVentas->DBVentas->DatabaseName;
     q->SQL->Add("Insert Into Project (Codigo, Nombre) Values (:Codigo,
:Nombre)");
     q->Prepare();     // if you execute the insert many times.
     try
       {
       q->ParamByName("Codigo")->AsInteger = 1234;
       q->ParamByName("Nombre")->AsString = "Karate y ValeTodo es lo
m�ximo.";
       q->ExecSQL();
       DMVentas->DBVentas->Commit();
        }
     catch(Exception& e)
        {
         DMVentas->DBVentas->Rollback();
        }

//--------------------------------------------------------------------------
-----

Good Luck, Bye!.

"pascal" <pascal.conrad@actavision.fr> escribi� en el mensaje
news:3f865dbc$1@newsgroups.borland.com...
> Hi,
>
> I've got problem with TDatabase et TParams.
>
> In this code
>
>    TParams *Params = new TParams();
>    hDBICur Cursor;
>
> try {
>    Params->CreateParam(ftString, "Pr_Code", ptInput);
>    Params->CreateParam(ftString, "Pr_Caption", ptInput);
>    Params->Items[0]->AsString=AnsiString(Code);
>    Params->Items[1]->AsString=Pr_Caption->Text;
>    SqlCmd="Insert into Project (Pr_Code,Pr_Caption,Pr_BgImage) Values
>            (:Pr_Code,:Pr_Caption,'N')";
>     DbMkt->Execute(SqlCmd,Param,false,&Cursor);
>    } __finally {
>      delete Params;
>    }
>
>
> He says 'I dont find the object' !
> Why ?
>
> And how can I use hDBICur
>
> Thank's
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads