Article View: borland.public.cppbuilder.database.ado
Article #5604Help in using stored procedure in MS SQL 2000
From: Chris Noble
Date: Wed, 04 Apr 2001 09:32
Date: Wed, 04 Apr 2001 09:32
48 lines
2428 bytes
2428 bytes
I am having problems in using a stored procedure in MS SQL 2000 (personal
edition) using the Enterprise version Builder 5 with the latest patches
applied on a Windows 2000 workstation. I have installed MDAC 2.6 and updated
the help for ADO Express (which still seem to be out of date!)
The ADO connection string works and I can access the data in the tables.
The stored procedure will look up the last supplier reference (integer) and
return its value or 0 if there are no entries in the column. I can find ways
round this by not using stored procedures but I would like to know how do
it. Please take note Borland!
The stored procedure is listed at the end:
I have failed to access the procedure and get OLE error 80040E 14 using
either the object inspector (design time) or the following code (run time):
ADOStoredProc1->Close();
ADOStoredProc1->ProcedureName = "GetLastSupplierRef";
try
{
ADOStoredProc1->Open(); // also tried ExecProc()
}
catch(EDatabaseError &E) // does not catch error
{
// how do you catch and decode the error?
}
Are there any examples of how to use stored procedures with SQL 2000 using
parameters and are there any updates to the documentation which currently
contains errors? eg ADOStoredProc1->SQL->Text = "ShowPurebreds"; there is no
SQL property in TADOStoredPROC.
Thanks for any help
Chris Noble
CREATE PROCEDURE GetLastSupplierRef
@Ref INT
AS
SET NOCOUNT ON
SELECT @Ref = MAX(Supplier_Ref)
FROM TicSuppliers
IF (@Ref = NULL)
BEGIN
SET @Ref = 0
END
RETURN 0
GO
Technical Details
Message-ID:
<3acaea3b_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!10.10.220.74.MISMATCH!sn-xit-04!supernews.com!newsfeed.mesh.ad.jp!feed.textport.net!news.bnb-lp.com!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,fec455fa27bb194e,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-04-04 02:47:28 PST From: "Chris Noble" <chris.noble@uce.ac.uk> Newsgroups: borland.public.cppbuilder.database.ado Subject: Help in using stored procedure in MS SQL 2000 Date: Wed, 4 Apr 2001 10:32:41 +0100 Lines: 52 Organization: Technology Innovation Centre, UCE 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: 62.30.209.80 Message-ID: <3acaea3b_1@dnews> X-Trace: dnews 986376763 62.30.209.80 (4 Apr 2001 02:32:43 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!10.10.220.74.MISMATCH!sn-xit-04!supernews.com!newsfeed.mesh.ad.jp!feed.textport.net!news.bnb-lp.com!dnews