Article View: borland.public.cppbuilder.database.ado
Article #4662Re: Problems with the ADOStoreProc parameters.
From: jqpdev
Date: Thu, 25 Oct 2001 14:27
Date: Thu, 25 Oct 2001 14:27
122 lines
4651 bytes
4651 bytes
Great!
I was going to try going the Access2000 queries as stored procedures, but I
just kept dumping the SQL in the ADO Commands... simply because I didn't
want to keep swapping back and forth between Access2k and Builder...
*grin*
How well does the approach work?
"Irongizon" <grangizon@lycos.es> wrote in message news:3bd7e6a0_1@dnews...
> 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:
<3bd8209c$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3bd6ab8c$1_1@dnews> <3bd70fe6$1_1@dnews> <3bd7e6a0_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 07:39:26 PST From: "jqpdev" <jqpdev@whowhatwhere.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3bd6ab8c$1_1@dnews> <3bd70fe6$1_1@dnews> <3bd7e6a0_1@dnews> Subject: Re: Problems with the ADOStoreProc parameters. Date: Thu, 25 Oct 2001 10:27:55 -0400 Lines: 124 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 NNTP-Posting-Host: 24.185.61.176 Message-ID: <3bd8209c$1_2@dnews> X-Trace: dnews 1004019868 24.185.61.176 (25 Oct 2001 07:24:28 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews