🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problems with the ADOStoreProc parameters.

#4652
From: jqpdev
Date: Wed, 24 Oct 2001 19:04
64 lines
2945 bytes
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: <3bd70fe6$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3bd6ab8c$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,2e97fc0938f037f6
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-10-24 12:11:39 PST
From: "jqpdev" <jqpdev@whowhatwhere.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3bd6ab8c$1_1@dnews>
Subject: Re: Problems with the ADOStoreProc parameters.
Date: Wed, 24 Oct 2001 15:04:17 -0400
Lines: 66
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: <3bd70fe6$1_1@dnews>
X-Trace: dnews 1003950054 24.185.61.176 (24 Oct 2001 12:00:54 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews