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  |  

  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
 


  Sponsors  

Meet Our Sponsors

SteadyRain
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
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Output Parameter
Previous Previous
 
Next Next
New Post 6/11/2006 7:18 PM
User is offline Tammy Adkins
21 posts
www.dnnextras.com
10th Ranked


Output Parameter 

I'm really stuck here - I'm trying to return an output param into my custom app from a stored procedure.  Here's what I've got . .

SqlProvider

Public Overrides Function Get_Measures(ByVal iD As Integer, ByRef VJan As Double, ByRef VFeb As Double) As IDataReader

Dim oParam1 As New SqlParameter("@ID", SqlDbType.Int)

With oParam1

.Value = iD

.Direction = ParameterDirection.Input

End With

Dim oParam4 As SqlParameter = New SqlParameter("@VJAN", SqlDbType.Float)

oParam4.Direction = ParameterDirection.Output

Dim oParam3 As SqlParameter = New SqlParameter("@VFEB", SqlDbType.Float)

oParam3.Direction = ParameterDirection.Output

Dim lReader As IDataReader = CType(SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, DatabaseOwner & ObjectQualifier & "TAM_HO_Goal_MeasuresGet", oParam1, oParam3, oParam4), IDataReader)

VJan = CType(oParam4.Value, Double)

VFeb = CType(oParam3.Value, Double)

Return lReader

End Function

 

DataProvider

Public MustOverride Function Get_Measures(ByVal iD As Integer, ByRef VJan As Double, ByRef VFeb As Double) As IDataReader

 

BusinessController

Public Function Get_Measures(ByVal iD As Integer, ByRef VJan As Double, ByRef VFeb As Double) As HoshinInfo

Return CType(CBO.FillObject(DataProvider.Instance().Get_Measures(iD, VJan, VFeb), GetType(HoshinInfo)), HoshinInfo)

End Function

 

And in my codebehind:

Dim VJan As Double

Dim VFeb As Double

Dim objHoshin As New HoshinController

Dim obj_Goals As HoshinInfo = objHoshin.Get_Measures(CType(lblGoalID.Text, Integer), VJan, VFeb)

txtVJan.Text = CType(obj_Goals.vJan, String)

txtVFeb.Text = CType(obj_Goals.VFeb, String)

My sp comes back correct - but my app gets nothing - ( I do a check for null, so I get a value of 0).  Does anyone see the problem??

Please Help!

 
New Post 6/12/2006 12:02 AM
User is offline Bilal Al-Ghazi
112 posts
9th Ranked


Re: Output Parameter 

Actually I managed to do it a little bit different way, my stored procedure is like this:

CREATE PROCEDURE [dbo].[GetUserAttemptCount]
 @UserID int,
AS

DECLARE @RESULT INT

SELECT
 @RESULT = Count(*)
FROM 
 UserAttempts
WHERE
 UserID = @UserID AND

SELECT @RESULT
GO

and then I used the following code in my SQLDataProvider:

Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & GetUserAttempts", userID), Integer)

 


Bilal Al-Ghazi Visit My Collection of Photos
 
New Post 6/12/2006 9:47 AM
User is offline Tammy Adkins
21 posts
www.dnnextras.com
10th Ranked


Re: Output Parameter 

Thanks very kindly for your reply, but executescalar is best for returning 1 value.  I'm trying to retrieve multiple output parameters.  Here's my stored procedure which returns the correct values - just having an issue returning the value within DNN.

ALTER             PROCEDURE dbo.TAM_HO_Goal_MeasuresGet
 (@ID int, @VJAN FLOAT OUTPUT, @VFEB FLOAT OUTPUT)
 
AS
DECLARE @JAN FLOAT
DECLARE @FEB FLOAT
DECLARE @PFEB FLOAT
DECLARE @PJAN FLOAT
DECLARE @UNIT INT


SELECT @UNIT=Type from TAM_HO_Goals_D where [ID] = @ID

SELECT @JAN=[Jan], @PJAN=[PJan], @Feb=[Feb], @PFEB=[PFeb] from TAM_HO_Goal_Measures where [GoalID]=@ID

if @UNIT = 1
BEGIN

SET @VJAN=COALESCE(@Jan,0)/COALESCE(@PJan,0) * 100
SET @VFEB=COALESCE(@Feb,0)/COALESCE(@PFeb,0) * 100

END

 

I'm guessing the issue lies within my sqlprovider - but not sure what to do . . .  Here's part of it again.

Dim lReader As IDataReader = CType(SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, DatabaseOwner & ObjectQualifier & "TAM_HO_Goal_MeasuresGet", oParam1, oParam3, oParam4), IDataReader)  <---- here maybe?

VJan = CType(oParam4.Value, Double)

VFeb = CType(oParam3.Value, Double)

Any help would be appreciated!

 
New Post 6/13/2006 5:49 AM
User is offline Tammy Adkins
21 posts
www.dnnextras.com
10th Ranked


Re: Output Parameter 
Is there a better way to accomplish this?
 
New Post 6/13/2006 8:22 AM
User is offline Stefan Cullmann
1489 posts
6th Ranked








Re: Output Parameter 

Hello tadskins,

your stored procedure is fine, the VB-Code not. You are not querying table data, so a datareader must be wrong.

Try this:

Dim param_id As New SqlParameter("id", SqlDbType.Int)
param_id.Value = <<your id>>
Dim param_vjan As New
SqlParameter("vjan", SqlDbType.Float)
param_vjan.Direction = ParameterDirection.Output
Dim param_vfeb As New
SqlParameter("vfeb", SqlDbType.Float)
param_vfeb.Direction = ParameterDirection.Output
SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "TAM_HO_Goal_MeasuresGet", _
                         
New Object() {param_id, param_vjan, param_vfeb})
Dim VJan As Double = CType(param_vjan.Value, Double
)
Dim VFeb As Double = CType(param_vfeb.Value, Double)


Stefan Cullmann - stefan.cullmann [at] dotnetnuke.com

forms & Lists (UDT5.0) will be the next major release of the User Defined Table project.
A first Preview is available, though it requires DotnetNuke 5 (Beta 5).

Need to import external data to a UDT? Try http://www.codeplex.com/Csv2UDTImport

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Output Parameter
 


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.

 


Web Development and Strategy Firm
The Risdall Interactive Agency s websites, strategies, branding, & promotion in digital space.
www.Risdall.net/
Windsor Management Group
Fund Accounting Software for K12 Education.
Infinitevisions.com
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 -

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