Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Ads  
OnyakTech
 


  Sponsors  

Meet Our Sponsors

DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
Verndale
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Getting the @Return_Value to the presentation Layer
Previous Previous
 
Next Next
New Post 8/19/2006 2:40 PM
User is offline John Bolduc
18 posts
10th Ranked


Getting the @Return_Value to the presentation Layer 

I have a StoredProcedure that evaluates the table and if certain conditions are met, completes an Update.  When I run it in the VS2005 Server Explorer it behaves exactly as designed (only updates the table if the conditions are met) and returns "@RETURN_VALUE = 0"(conditions not met) or "@RETURN_VALUE = 1" (conditions met) exactly as I want.  However, when I try to call it from my application it , always updates the table, no matter if the conditions are met or not.  I also obviously don't understand how to pass the @RETURN_VALUE back thru the SqlDataProvider, DataProvider, and Controller file to display to the user the messages I want to. I always ge thte failure message with a successful update.  Is there a tutorial on or example on using @RETURN_VALUE in the DAL, BLL, or anyone willing to give me a hand?

The Stored Procedure (this Works in server Explorer):

ALTER PROCEDURE dbo.[PSLPD_OverTime_SignUp48Count]

(

@ID int,

@ModuleID int,

@Shift nvarchar(50),

@SignedUpUser nvarchar(50),

@CreatedByUser nvarchar(250),

@DateSignedUp datetime

)

AS

DECLARE @48Count Int

SELECT @48Count = COUNT(*)

FROM PSLPD_OverTime

WHERE (ModuleID = @ModuleID) AND (SignedUpUser = @SignedUpUser) AND (Shift = @Shift) AND (CreatedByUser = @CreatedByUser)

AND (DateofShift >= GETDATE()) AND (DATEDIFF(minute, DateEntered, GETDATE()) <= 2880)

UPDATE PSLPD_OverTime

SET SignedUpUser =@SignedUpUser, DateSignedUp = @DateSignedUp

WHERE ID = @ID AND (@48Count < 2)

RETURN @@rowcount

I will post whatever code is needed...

John


John
 
New Post 8/22/2006 7:29 PM
User is offline John Bolduc
18 posts
10th Ranked


Re: Getting the @Return_Value to the presentation Layer 

Affected Rows always comes back as -1, even when the row has been updated.  I added the Return_Value to the *Info.vb in the App_Code folder.  Any hints as to what to add to the sqldataprovider to pass Return_Value back up?

Just a hint...


John
 
New Post 8/22/2006 8:40 PM
User is offline eck two
330 posts
8th Ranked


Re: Getting the @Return_Value to the presentation Layer 
When declaring the function in sqldataprovider, one of the parameter usedin the function definition used to pass back the return value should be declared as "byRef".
 
New Post 8/24/2006 5:02 PM
User is offline John Bolduc
18 posts
10th Ranked


Re: Getting the @Return_Value to the presentation Layer 

I figured it out, here are the answers just in case it will help someone else out.                                                

[QUOTE]jbolduc wrote
 However, when I try to call it from my application it , always updates the table, no matter if the conditions are met or not. 

After I thought about it, it  was obviously a parameter problem. Rechecked and a couple of the parameters needed to perform the count function in sproc were not being provided. Fixed...

Getting  the Return_Value back to the ObjectDataSource Updating Method was a little harder.  Here is the code from SQLDataProvider, DataProvider, and Controller files that made it work.

SqlDataProvider-->

Public Overrides Function PSLPD_OverTime_SignUp48Count(ByVal Id As Integer, ByVal ModuleId As Integer, ByVal Shift As String, ByVal SignedUpUser As String, ByVal CreatedByUser As String, ByVal DateSignedUp As DateTime) As Integer

Dim Return_Value As Integer

Return_Value = SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("PSLPD_OverTime_SignUp48Count"), Id, ModuleId, Shift, SignedUpUser, CreatedByUser, DateSignedUp)

Return Return_Value

End Function

DataProvider-->

Public MustOverride Function PSLPD_OverTime_SignUp48Count(ByVal Id As Integer, ByVal ModuleId As Integer, ByVal Shift As String, ByVal SignedUpUser As String, ByVal CreatedByUser As String, ByVal DateSignedUp As DateTime) As Integer

Controller-->

<DataObjectMethod(DataObjectMethodType.Update, True)> _

Public Shared Function OverTime_SignUp48Count(ByVal objTest As OverTimeInfo) As Integer

Dim Return_Value As Integer

Return_Value = DataProvider.Instance.PSLPD_OverTime_SignUp48Count(objTest.ID, objTest.ModuleId, objTest.Shift, objTest.SignedUpUser, objTest.CreatedByUser, objTest.DateSignedUp)

Return Return_Value

End Function

Hope it helps.. John


John
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Getting the @Return_Value to the presentation Layer
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Convert Visitors to Customers
In order to bring value to your users, we must first understand them. VIVIDSITES will help you build a custom web application and interactive marketing tools that your users will thank you for. We marry high-end creative with head banging technology to entertain and convert visitors into paying customers. Call 314.514.0505 or visit us at http://www.vividsites.com to find out how.
- V I V I D S I T E S -
Gearworx Web Hosting
As a premier provider of Web Hosting, Private/White Label hosting, Server Colocation, Dedicated Server, and other Managed Services, Gearworx offers an array of services designed to more effectively manage strategies driving businesses on the Web. Headquartered in Fremont, California our state of the art tier one data centers and distributed managed services environment enables Gearworx to offer your business enterprise level solutions through simplified processes.
Gearworx Web Hosting
Glanton: Enterprise Intranet Specialists Using DNN
Glanton Solutions are a premier provider of sevices for large corporates lloking to outsource Intranet sites.
www.glanton.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP