Vladan, Here is my code, it is basically a normal module setup and I'm providing the text typed into the Filter text box as what is required.
<HTML ObjectDataSource Code> <asp:ObjectDataSource ID="ObjectDataSourceCRS" runat="server" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTmgr_CourseTypes"> </asp:ObjectDataSource> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTmgr_FltTraining" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController"> <SelectParameters> <asp:ControlParameter ControlID="txtFilter" Name="CourseID" PropertyName="Text" Type="String" DefaultValue="" /> </SelectParameters> </asp:ObjectDataSource>
</HTML ObjectDataSource Code>
Calls the method in the CourseTypeController <CourseTypeController Code> Imports System Imports System.Configuration Imports System.Data Imports System.XML Imports System.Web Imports System.Collections.Generic Imports DotNetNuke Imports DotNetNuke.Services.Search Imports DotNetNuke.Common.Utilities.XmlUtils Imports DotNetNuke.Common.Utilities
Namespace HomeProd.Modules.Tmgr_CourseType
Public Class Tmgr_CourseTypeController
#Region "Public Methods"
'Public Function GetTmgr_CourseTypes(ByVal ModuleID As Integer) As List(Of Tmgr_CourseTypeInfo) ' Return CBO.FillCollection(Of Tmgr_CourseTypeInfo)(DataProvider.Instance().GetTmgr_CourseTypes(ModuleID)) Public Function GetTmgr_CourseTypes() As List(Of Tmgr_CourseTypeInfo)
Return CBO.FillCollection(Of Tmgr_CourseTypeInfo)(DataProvider.Instance().GetTmgr_CourseTypes()) End Function
Public Function GetTmgr_CourseType(ByVal ModuleID As Integer, ByVal ItemId As Integer) As Tmgr_CourseTypeInfo
Return CType(CBO.FillObject(DataProvider.Instance().GetTmgr_CourseType(ModuleID, ItemId), GetType(Tmgr_CourseTypeInfo)), Tmgr_CourseTypeInfo)
End Function
Public Function GetTmgr_FltTraining(ByVal CourseID As String) As Tmgr_CourseTypeInfo
Return CType(CBO.FillObject(DataProvider.Instance().GetTmgr_FltTraining(CourseID), GetType(Tmgr_CourseTypeInfo)), Tmgr_CourseTypeInfo)
End Function
Public Sub AddTmgr_CourseType(ByVal objTmgr_CourseType As Tmgr_CourseTypeInfo)
DataProvider.Instance().AddTmgr_CourseType(objTmgr_CourseType.ModuleID, objTmgr_CourseType.CourseID, objTmgr_CourseType.CourseName, objTmgr_CourseType.CourseVendor)
End Sub
Public Sub UpdateTmgr_CourseType(ByVal objTmgr_CourseType As Tmgr_CourseTypeInfo)
DataProvider.Instance().UpdateTmgr_CourseType(objTmgr_CourseType.ModuleID, objTmgr_CourseType.ID, objTmgr_CourseType.CourseID, objTmgr_CourseType.CourseName, objTmgr_CourseType.CourseVendor)
End Sub
Public Sub DeleteTmgr_CourseType(ByVal ModuleID As Integer, ByVal ItemId As Integer)
DataProvider.Instance().DeleteTmgr_CourseType(ModuleID, ItemId)
End Sub
#End Region
#Region "Optional Interfaces"
#End Region
End Class End Namespace
</CourseTypoeController Code>
<SQLDataProvider Code> Imports System Imports System.Data Imports System.Data.SqlClient Imports Microsoft.ApplicationBlocks.Data Imports DotNetNuke
Namespace HomeProd.Modules.Tmgr_CourseType
Public Class SqlDataProvider
Inherits DataProvider
#Region "Private Members"
Private Const ProviderType As String = "data" Private Const ModuleQualifier As String = "HomeProd_"
Private _providerConfiguration As Framework.Providers.ProviderConfiguration = Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType) Private _connectionString As String Private _providerPath As String Private _objectQualifier As String Private _databaseOwner As String
#End Region
#Region "Constructors"
Public Sub New()
' Read the configuration specific information for this provider Dim objProvider As Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), Framework.Providers.Provider)
' Read the attributes for this provider If objProvider.Attributes("connectionStringName") <> "" AndAlso _ System.Configuration.ConfigurationManager.AppSettings(objProvider.Attributes("connectionStringName")) <> "" Then _connectionString = System.Configuration.ConfigurationManager.AppSettings(objProvider.Attributes("connectionStringName")) Else _connectionString = objProvider.Attributes("connectionString") End If
_providerPath = objProvider.Attributes("providerPath")
_objectQualifier = objProvider.Attributes("objectQualifier") If _objectQualifier <> "" And _objectQualifier.EndsWith("_") = False Then _objectQualifier += "_" End If
_databaseOwner = objProvider.Attributes("databaseOwner") If _databaseOwner <> "" And _databaseOwner.EndsWith(".") = False Then _databaseOwner += "." End If
End Sub
#End Region
#Region "Properties"
Public ReadOnly Property ConnectionString() As String Get Return _connectionString End Get End Property
Public ReadOnly Property ProviderPath() As String Get Return _providerPath End Get End Property
Public ReadOnly Property ObjectQualifier() As String Get Return _objectQualifier End Get End Property
Public ReadOnly Property DatabaseOwner() As String Get Return _databaseOwner End Get End Property
#End Region
#Region "Private Methods"
Private Function GetFullyQualifiedName(ByVal name As String) As String Return DatabaseOwner & ObjectQualifier & ModuleQualifier & name End Function
Private Function GetNull(ByVal Field As Object) As Object Return DotNetNuke.Common.Utilities.Null.GetNull(Field, DBNull.Value) End Function
#End Region
#Region "Public Methods"
'Public Overrides Function GetTmgr_CourseTypes(ByVal ModuleID As Integer) As IDataReader ' Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_CourseTypes"), ModuleID), IDataReader) Public Overrides Function GetTmgr_CourseTypes() As IDataReader Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_CourseTypes")), IDataReader) End Function
Public Overrides Function GetTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Integer) As IDataReader Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_CourseType"), ModuleID, ID), IDataReader) End Function
Public Overrides Function GetTmgr_FltTraining(ByVal CourseID As String) As IDataReader Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_FltTraining"), CourseID), IDataReader) End Function
Public Overrides Sub AddTmgr_CourseType(ByVal ModuleID As Integer, ByVal CourseID As String, ByVal CourseName As String, ByVal CourseVendor As String) SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddTmgr_CourseType"), ModuleID, CourseID, CourseName, CourseVendor) End Sub
Public Overrides Sub UpdateTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Int32, ByVal CourseID As String, ByVal CourseName As String, ByVal CourseVendor As String) SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateTmgr_CourseType"), ModuleID, ID, CourseID, CourseName, CourseVendor) End Sub
Public Overrides Sub DeleteTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Integer) SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteTmgr_CourseType"), ModuleID, ID) End Sub
#End Region
End Class
End Namespace </SQLDataProvider Code>
<DataProvider Code> Imports System Imports DotNetNuke Imports System.Data
Namespace HomeProd.Modules.Tmgr_CourseType
Public MustInherit Class DataProvider
' Provider constants - eliminates need for Reflection later Private Const mDataProviderType As String = "data" Private Const mDataNameSpace As String = "HomeProd.Modules.Tmgr_CourseType" Private Const mDataAssemblyName As String = ""
#Region "Shared/Static Methods"
'singleton reference to the instantiated object Private Shared objProvider As DataProvider = Nothing
' constructor Shared Sub New() CreateProvider() End Sub
' dynamically create provider Private Shared Sub CreateProvider() If objProvider Is Nothing Then objProvider = CType(Framework.Reflection.CreateObject("data", "HomeProd.Modules.Tmgr_CourseType", ""), DataProvider) End If End Sub
' return the provider Public Shared Shadows Function Instance() As DataProvider Return objProvider End Function
#End Region
#Region "Abstract methods"
'Public MustOverride Function GetTmgr_CourseTypes(ByVal ModuleID As Integer) As IDataReader Public MustOverride Function GetTmgr_CourseTypes() As IDataReader Public MustOverride Function GetTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Integer) As IDataReader Public MustOverride Function GetTmgr_FltTraining(ByVal CourseID As String) As IDataReader Public MustOverride Sub AddTmgr_CourseType(ByVal ModuleID As Integer, ByVal CourseID as String, ByVal CourseName as String, ByVal CourseVendor as String) Public MustOverride Sub UpdateTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID as Int32, ByVal CourseID as String, ByVal CourseName as String, ByVal CourseVendor as String) Public MustOverride Sub DeleteTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID as Integer)
#End Region
End Class
End Namespace </DataProvider Code>
<CourseTypeInfo Code> Imports System Imports System.Configuration Imports System.Data
Namespace HomeProd.Modules.Tmgr_CourseType
Public Class Tmgr_CourseTypeInfo ' local property declarations Private _ModuleID As Integer Private _ID as Int32 Private _CourseID as String Private _CourseName as String Private _CourseVendor as String
' initialization Public Sub New() End Sub
' public properties Public Property ModuleID() As Integer Get Return _ModuleID End Get Set(ByVal Value As Integer) _ModuleID = Value End Set End Property
Public Property ID() As Int32 Get Return _ID End Get Set(ByVal Value As Int32) _ID = Value End Set End Property
Public Property CourseID() As String Get Return _CourseID End Get Set(ByVal Value As String) _CourseID = Value End Set End Property
Public Property CourseName() As String Get Return _CourseName End Get Set(ByVal Value As String) _CourseName = Value End Set End Property
Public Property CourseVendor() As String Get Return _CourseVendor End Get Set(ByVal Value As String) _CourseVendor = Value End Set End Property
End Class
End Namespace </CourseTypeInfo Code>
<Stored Procedure Code> set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go
-- ============================================= -- Author: Peter Annandale -- Create date: 15/04/2006 -- Description: Filter Training by Course Code -- ============================================= ALTER PROCEDURE [dbo].[HomeProd_GetTmgr_FltTraining] @CourseID nvarchar(20) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON;
SELECT @CourseID = '%' + RTRIM(@CourseID) + '%'; SELECT ModuleID, ID, CourseID, CourseName, CourseVendor FROM HomeProd_Tmgr_CourseType WHERE CourseID LIKE @CourseID ORDER BY CourseID; END
</Stored Procedure Code>
I have looked at this code several times and am none the wiser as to why it is returning only one record, to me it looks like it is ignoring the 'LIKE' operator and using an equals operator from the code. If I run the Stored Procedure from the SQL DataBase it does what I would expect it to do.
Look forward to hearing from you
Regards.. Peter.
|