๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #4659

Re: Problems with the ADOStoreProc parameters.

#4659
From: Irongizon
Date: Thu, 25 Oct 2001 10:17
104 lines
4053 bytes
Hey jqpdev:

At First , I'll answer to your Questions:

A1: I'm using Access 2000 provisionaly, until the same database was ready on
a MS SQL Server.
A2: I used Open instead using the property Active = true. I'm using the
Queries in Access as StoreProcedures, that later will be in MS SQL Server as
really StoreProcedures.

At Second, I've resolved my problem using ADOCommand componentes.
Changing the ADOCommand values of the parameters, I call the Excute method
of the ADOCommand and  I load the result set in a Recordset.

For Ex:

    _di__Recordset Rcrcs = NULL;
    for (i=0; i<Max; i++){

          MyADOCommand->Parameters->ParamByName("Param1")->Value =
Variant(&i);
          Rcrcs = MyADOCommand->Execute();

          // Here I process the Rcrcs data
         Rcrcs->Close();
   }

It works.
Thanks for all.

Bye.
Raul.


"jqpdev" <jqpdev@whowhatwhere.com> escribi๏ฟฝ en el mensaje
news:3bd70fe6$1_1@dnews...
> Hey Irongizon...
> I got a couple of  questions and a suggestion or two.
> Q1. Why are you using a stored procedure with Access 2000?
> Q2.  Why are you using the Open() method?
>
> Here are my suggestions...
> S1. Since as fas as I know Access2000 doesn't have store procedure support
> as a feature you shouldn't use a stored procedure component.  Try using
> ADOCommand.  It will allow you to place your SQL statement in it.  You can
> specify params in the statement by :param1, :param2, etc.
>
> S2.  If you still want to use the stored procedure or choose to go with
the
> ADOCommand,
> you should use the ExecProc() method for stored procedures and Execute()
> method for the ADOCommand.  This assumes that your are not returning a
> dataset, from the SQL Statement;
>
> For Ex:
> UPDATE (tbl_Employee)
> SET employee_type = 5
> WHERE employee_ID = 4501;
>
> Ex#2:
> UPDATE (tbl_Employee)
> SET employee_type = :NewEmpType
> WHERE employee_ID = :EmpID;
>
> The second example uses parameters.
>
> By the way this statement is correct...
>       MyStoredProc->Parameters->ParamByName("param1")->Value = i;
>
> Good luck and write back if it doesn't work/help.
>
>
> "Irongizon" <grangizon@lycos.es> wrote in message
news:3bd6ab8c$1_1@dnews...
> > Hi.
> >
> > I'm using ADO components in a  C++ Builder 5 application. I'm using a
> > MSAccess 2000 database in which I have some parametered queries. With an
> > TADOStoreProc I try to use one of this parametered query, in this way:
> >
> > for (i=0; i<CRCIDBLK_MAXNUMERO; i++){
> >
> >       MyStoredProc->Close();
> >       MyStoredProc->Parameters->ParamByName("param1")->Value = i;
> >       MyStoredProc->Open();
> >
> >       // Process of Data
> >       .....
> > }
> >
> > What happend is that the parameter value is not updated for each call,
> > although I close the StoreProc and it always returns the same result. It
> > always takes the value that is given in the first time (i=0).
> > I would be grateful whether somebody Knows how to do the value of the
> param
> > was updated.
> >
> > Regards and Thanks in advanced.
> >
> > Raul.
> >
> >
>
>
Technical Details
Message-ID: <3bd7e6a0_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3bd6ab8c$1_1@dnews> <3bd70fe6$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,2e97fc0938f037f6
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-10-25 03:18:25 PST
From: "Irongizon" <grangizon@lycos.es>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3bd6ab8c$1_1@dnews> <3bd70fe6$1_1@dnews>
Subject: Re: Problems with the ADOStoreProc parameters.
Date: Thu, 25 Oct 2001 12:17:17 +0200
Lines: 106
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 195.55.170.90
Message-ID: <3bd7e6a0_1@dnews>
X-Trace: dnews 1004005024 195.55.170.90 (25 Oct 2001 03:17:04 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews