Capture a SQL server's return value in code

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Can someone off me some starting air code for the following?
How do I have a stored procedure send a return value,
then have my code capture the result?

Here's what I'm trying to do... in a form's code, I need to check if a
user is a member of a permissions group.
I can call a stored procedure that uses this T-SQL:

IF (IS_MEMBER('CRRR\HR-AllAccess') = 1)
Begin
--The user is a member
End
Else
Begin
--The user is not a member
Else

What is the T-SQL to fire back the result... and how do I capture that
value in code?

Thanks in advance!
 
By result, do you mean a RETURN value or a recordset?

For Return values, the best way is probably to use the ADODB command object
with parameters to call the SP and capture the return value. If you take a
look at the previous posts in this newsgroup, you will see many exemple on
how to use the ADODB objects from ADP. For Recordsets, use an ADODB
recordset object to open the SP and capture the result.

If you want to use ADP on a regular basis, it's a very good idea to become
familiar with those objects.
 
I was able to solve this problem, with help from Doug Steele in the
microsoft.public.access.formscoding group. In case someone is looking
for a solution, take a look at this post:

Title: "Checking permission rights using SQL Server Stored Procedure
and return values"
in microsoft.public.access.formscoding

Best regards,

Scott
 
Back
Top