473,770 Members | 5,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

return values and recordset in one stored procedure

2 New Member
Hi

We have an application that runs fine on SQL 2000. Due to other applications we are forced to move to SQL 2005.

One Stored Procedure isn't working on the new SQL 2005. It's a SP with output parameters and a recordset. It's working fine on SQL 2000.

The data is returned through OLEDB to a VB6 application. In this application the output parameters are working fine (can access them). But the recordset isn't working. Both EOF en BOF are true...

Executing the SP from SQL Server Management Studio works fine.

Is it not allow to have output parameters and a recordset anymore? Or is the code different?

I hope you can help...


Below is the SP and the VB6 code:

Expand|Select|Wrap|Line Numbers
  1. ALTER PROCEDURE [dbo].[ADM_LS_SelectUserPassword]
  2.   @UserName   varchar(16),
  3.   @UserID  int  OUTPUT,
  4.   @UserPassword  varchar(16) OUTPUT,
  5.   @UserNickname  varchar(16) OUTPUT,
  6.   @UserErrCount smallint  OUTPUT,
  7.   @UserLastname varchar(32) OUTPUT,
  8.   @Expired int OUTPUT
  9. AS
  10. BEGIN
  11. SET NOCOUNT ON;
  12.  
  13. DECLARE @ExpireDate smalldatetime,@PWChanged smalldatetime
  14.  
  15.  
  16. SELECT distinct @UserNickname = PAEm_Nickname, @UserLastname = PAEm_Lastname, @UserPassword = PAEm_Password, @UserID = PAEm_ID, @UserErrCount = PAEm_ErrCount,@PWChanged = PAEm_PWLastChanged
  17. FROM ADM_PA_Employee, ADM_PA_CntrGlobal
  18. WHERE PAEm_Username = @Username and PACG_FK_PAEm_ID = PAEm_ID and (PACg_Enddate > dateadd(day,-1,getdate()) or PACg_Enddate is null)
  19.  
  20. --Kijken en instellen of het wachtwoord niet is verlopen
  21. SET @ExpireDate = DATEADD(mm,CONVERT(int,(SELECT CMPa_Value FROM ADM_CM_PARAMETERS WHERE CMPa_Code = 'PWExpire')),@PWChanged)
  22. IF @ExpireDate < getdate() SET @Expired = 1
  23. ELSE SET @Expired = 0
  24.  
  25. IF @UserPassword != '' 
  26. begin 
  27. if isnull(@UserNickname,'') = '' 
  28.   SELECT @UserNickname = PAEm_Firstname
  29.   FROM ADM_PA_Employee
  30.   WHERE PAEm_Username = @Username
  31. end
  32.  
  33.  
  34. IF @UserID > 0
  35.   SELECT distinct sysobjects.name
  36.   FROM sysobjects, sysprotects, sysusers, ADM_LS_Groups, ADM_LS_EmployeeGroups, ADM_PA_Employee
  37.   WHERE xtype = 'P' 
  38.     and sysobjects.id = sysprotects.id 
  39.     and sysprotects.uid = sysusers.uid
  40.     and (sysprotects.protecttype = 204 or sysprotects.protecttype = 205)
  41.     and LSGr_Login = sysusers.name
  42.     and LSGr_ID = LSEG_FK_LSGr_ID
  43.     and LSEG_FK_PAEm_ID = PAEm_ID
  44.     and PAEm_ID = @UserID
  45.   ORDER BY sysobjects.nameELSE
  46.  SELECT * FROM ADM_PA_Employee WHERE PAEm_ID = 1 and PAEm_ID = 2
  47. END
  48.  
Expand|Select|Wrap|Line Numbers
  1. dbCom.CommandText = "ADM_LS_SelectUserPassword"
  2. dbCom.CommandType = adCmdStoredProc
  3. dbCom.Parameters.Refresh
  4.  
  5. dbCom(1).Value = strUserName
  6.  
  7. dbRst.Open dbCom
  8.  
  9.  
  10. If dbRst.EOF = True Or dbRst.BOF = True Then
  11.   dbRst.Close
  12.   If Not IsNull(dbCom(2).Value) Then
  13.     Err.Raise 1004, , "User has no permissions: " & strUserName
  14.   Else
  15.     Err.Raise 1000, , "Unknown user: " & strUserName
  16.   End If
  17. Else
  18.   ReDim strGroup(0)
  19.   Do While Not dbRst.EOF
  20.     ReDim Preserve strGroup(UBound(strGroup) + 1)
  21.     strGroup(UBound(strGroup) - 1) = dbRst.Fields(0)
  22.     dbRst.MoveNext
  23.   Loop
  24.   dbRst.Close
  25. End If
  26.  
Sep 11 '06 #1
1 16693
rover
2 New Member
A little update.

So it seems that the issue is not related to the return values and recordset.

I have created a small test application which returns a recordset just fine.

Could it be possible that SQL 2005 prevents information from sysobject to be exported (using SQL)?

I have this in a stored procedure where I fetch a list of stored procedures where a user has rights:

Expand|Select|Wrap|Line Numbers
  1. SELECT distinct sysobjects.name
  2.   FROM sysobjects, sysprotects, sysusers, ADM_LS_Groups, ADM_LS_EmployeeGroups, ADM_PA_Employee
  3.   WHERE xtype = 'P' 
  4.     and sysobjects.id = sysprotects.id 
  5.     and sysprotects.uid = sysusers.uid
  6.     and (sysprotects.protecttype = 204 or sysprotects.protecttype = 205)
  7.     and LSGr_Login = sysusers.name
  8.     and LSGr_ID = LSEG_FK_LSGr_ID
  9.     and LSEG_FK_PAEm_ID = PAEm_ID
  10.     and PAEm_ID = @UserID
  11.   ORDER BY sysobjects.name
  12.  
Sep 12 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
22929
by: Vipul Pathak | last post by:
Hello Friends ! I have the Following Code, that Executes a Stored Procedure and Attempt to read a Returned Integer Value from the StoredProc. But It gives Error ... ADODB.Command (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. /C4U/DBOutputParameterTest.asp, line 25
7
5730
by: JT | last post by:
how can i see a stored procedures return value in ASP??
3
3175
by: sumGirl | last post by:
Hi all. I have a stored procedure on my sql server that returns a simple informtation about that tim a database was backed up. I owuld like to create an HTA that operator types can look at to make sure that the backups finished, can someone help me do this? The stored procedure in called sp_lastback and the output looks like this: database days since backup timestamp of backup dbase1 0 2004-10-14 00:41:21.000
2
3413
by: Daniel | last post by:
hi ng, i am newbie to sqlserver and my problem seems simple, but i didn't find information about it: How can i display the RETURN @x value of a stored procedure in the sql analyzer of the sqlserver? thanks a lot, d
1
11320
by: stjulian | last post by:
I have a stored procedure which returns 2 tables and 1 output value. I want the first table to be assigned to rs1 and the second to rs2. However when I run this, I get the following error as I begin to refer to the rs2 recordset (Do while not rs2.eof). I have even used 2 ".execute" statements in the code below, but the code assigns the first recordset twice. Microsoft VBScript runtime error '800a01a8' Object required: 'rs2' ...
8
11263
by: colmkav | last post by:
Can someone tell me how I can access the return value of a function called from Oracle as opposed to a store proc from oracle? my oracle function is get_num_dates_varposfile. I am only used to using this method with store procs that dont return a value back to Access. Hope this makes sense. Set Cmd = New Command With Cmd Set .ActiveConnection = get_XE_Conn 'makes a connection Oracle XE
12
5141
by: Dooza | last post by:
I have a stored procedure that takes a number of inputs, does a bulk insert, and then outputs a recordset. When I run the stored procedure in Server Management Studio I also get a return value from the stored procedure which is an INT. I want to access this return value on my ASP/VBScript page, but do not know how to access it. Here is my code so far:
6
3486
by: SethM | last post by:
I have a stored procedure that returns a record set. I want to functionalize this so I can have multiple presentations of the same record set. However, I can not get rs_event.open StoreProc to pass through the function, so I can use rs_event("Title"), etc, etc. Is this possible to do? If so how? Thanks. Regards, Seth
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.