Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 19th, 2003, 06:36 PM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling stored procedure with output parameters

I have an access 2000 adp project with an SQL 2000 backend server, I am trying to call a stored procedure with an input and output parameter. My store procedures look like this:

Alter Procedure prcCHK
    (
        @cuid as int,
        @pts as char(10) output
    )
As
select top 1 @pts=pts from tblp1 where custid=@cuid
return

my access procedure look like

   Dim CustomerID As Integer
   Dim pts As String
   CustomerID = 3065
   Set dblocal = CurrentProject.Connection
   dblocal.Execute ("prcCHK" & "'" & CustID & "' , '" & pts & "'")

All I want the code to do is call the stored procedure "prcCHK" and for it to return the a single value 'pts'

I have checked the syntax and it work fine outside of access (SQL Query Analyser) but does not when called from the access code. Any suggestions on how I can get the stored procedure to return a single value to the calling access procedure/function.


 
Old November 19th, 2003, 07:30 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

 Dim CustomerID As Integer
   Dim pts As String
   CustomerID = 3065
   Set dblocal = CurrentProject.Connection
   dblocal.Execute ("prcCHK" & "'" & CustID & "' , '" & pts & "'")

Try to execute using the "dbo"permissions.

 Dim CustomerID As Integer
   Dim pts As String
   CustomerID = 3065
   Set dblocal = CurrentProject.Connection
   dblocal.Execute ("dbo.prcCHK" & "'" & CustID & "' , '" & pts & "'")



 
Old November 10th, 2004, 11:00 AM
Registered User
 
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I too have the exact same need. When I figure this out, I'll post my solution. I have a SP working in QA but Access 2003 won't return the value from the SP output. It is like Access only can see tables/datasets and not just a "memory variable" with a value from a column, which is what the SP seems to be returning. Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
calling stored procedure jomet JSP Basics 0 November 23rd, 2007 08:06 AM
Accessing Stored Procedure's output parameters. Gurudath BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 May 24th, 2007 07:00 AM
Calling Stored Procedure with parameters zarina_24 Classic ASP Professional 4 March 2nd, 2006 11:57 AM
problems with stored proc and output parameters zieg42 VB.NET 2002/2003 Basics 1 June 12th, 2004 07:11 AM
Calling Stored procedures with out parameters bansalh Access 1 November 25th, 2003 04:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.