Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Output ParametersOutput Parameters
Previous
 
Next
New Post
1/29/2009 9:24 AM
 

Hi

Can someone please assist me with changing the code in the DAL to handle output parameters from a SQL stored proc? 

I have a stored procedure that returns the results of a basic search module.   I have changed the procedure to only return the result based on the page index and number of rows per page that is set for the gridview, hence making the recordset returned small and only relevant to the page the user is viewing.  (I won't be able to use the page index eventually, but that is not what I'm worried about at this point)

To do this, I will not be using the gridview's native paging information (as it will always show just one page) but rather the First Next Previous Last scrolling mechanism.  I will then also have to tell the user which page he is on and how many total records there are. 

The stored procedure returns the total number of records as an output parameter.  Now the DAL has to cater for a returned record set as well as an output parameter and I can't seem to figure it out or find any information on it online.

This is my proc:

ALTER procedure [dbo].[PracticalComforts_GetLSTResultsMain]

(
@ComboProvinceData VARCHAR(250),
@ComboCityRegionData VARCHAR(250),
@ComboAreaData VARCHAR(250),
@ComboSuburbData VARCHAR(250),
@SearchWord VARCHAR(100),
@MaximumRows INT,
@CurrentPage INT,
@SortExpression VARCHAR(50) = NULL,
@TotalRecords INT OUTPUT
)

AS

some code here....

SQL Data Provider

        Public Overrides Function GetLSTResultsMain(ByVal ResultsProvince As String, ByVal ResultsCityOrRegion As String, ByVal ResultsGreaterArea As String, ByVal ResultsComboSuburb As String, ByVal ResultsSearchCriteria As String, ByVal ResultsListingMaximumRows As Integer, ByVal ResultsListingCurrentPage As Integer, ByVal ResultsListingSortExpression As String) As IDataReader

            Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetLSTResultsMain"), ResultsProvince, ResultsCityOrRegion, ResultsGreaterArea, ResultsComboSuburb, ResultsSearchCriteria, ResultsListingMaximumRows, ResultsListingCurrentPage, ResultsListingSortExpression), IDataReader)

        End Function
 

Gridview data source:

  <asp:ObjectDataSource ID="odsMainListing"
            runat="server"
            SelectMethod="GetLSTResultsMain"
            SortParameterName="ResultsListingSortExpression"
            TypeName="PracticalComforts.Modules.LSTResults.LSTResultsController"
            OldValuesParameterformatString="original_{0}">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ddlProvince" Name="ResultsProvince" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:ControlParameter ControlID="ddlCityorRegion" Name="ResultsCityOrRegion" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:ControlParameter ControlID="ddlGreaterArea" Name="ResultsGreaterArea" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:ControlParameter ControlID="ddlSuburb" Name="ResultsComboSuburb" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:ControlParameter ControlID="TextBox1" Name="ResultsSearchCriteria" PropertyName="Text"
                        Type="String" />
                    <asp:Parameter Name="ResultsListingMaximumRows" Type="Int32" />
                    <asp:Parameter Name="ResultsListingCurrentPage" Type="Int32" />
                    <asp:Parameter Name="ResultsListingSortExpression" Type="String" />
                    <asp:Parameter Name="TotalRecords" Direction="Output" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>   

Code behind file:

Protected Sub odsMainListing_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs) Handles odsMainListing.Selecting

            Dim iPageIndex As Integer
            Dim iPageSize As Integer
            Dim sSortExpression As String

            iPageIndex = GridviewMainListing.PageIndex
            iPageSize = GridviewMainListing.PageSize
            sSortExpression = GridviewMainListing.SortExpression

            'make sure the parameters are set properly
            e.InputParameters("ResultsListingSortExpression") = sSortExpression
            e.InputParameters("ResultsListingCurrentPage") = iPageIndex
            e.InputParameters("ResultsListingMaximumRows") = iPageSize

        End Sub

Please ask if any more information is needed.

Thanks in advance

Michelle

 
New Post
1/29/2009 1:39 PM
 

there is a glitch in the DNN dataprovider not returing the value of output parameters. use return values or datareaders instead (see Usersonline module for example).


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
2/3/2009 12:03 AM
 

Hi Sebastian

Thank you for the feedback.  I have spent the best part of a couple of days to try and get info on the usersonline module so I can see how it works, but I feel like I'm missing something simple...?

How do I install the UsersOnline module to my current development project so that I can se the Dataprovider.vb, Controller.vb, Info.vb and SQLDataProvider.vb files for an example?

I can see the stored procedures and the ascx files, but none of the vb stuff....  this is where I need the most input.

Can you assist?

Thanks

Michelle

 
New Post
2/5/2009 10:04 AM
 

Because I could not find anything with substance to help me with this thread, I decided to create another objectdatasource that returns the total number of pages based on the same input parameters as the main objectdatasource.

Not ideal as every call to the db calls the same query twice effectively.  So until I find something that works, this will have to do.

Michelle.

 
New Post
2/5/2009 3:40 PM
 

Michelle,

Install source version of the module via UI like the install version  (Install New Module command in Host :: Module Definitions) and the files will show up.

Please be aware, that UOL is still a DNN 3 module compiled with VS2003 and ASP.Net 1.1


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Output ParametersOutput Parameters


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out