The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Problem calling Stored Proc

Last post 02-04-2008, 12:42 PM by liffey. 1 replies.
Sort Posts: Previous Next
  •  02-04-2008, 11:51 AM 7904

    Problem calling Stored Proc

    Can anyone see what I am doing wrong?

    Code:
    1            Public Function CustomGetEventsByRange(ByVal ModID As Integer, _
    2                                                ByVal StartDate As DateTime, _
    3                                                ByVal EndDate As DateTime) As IDataReader
    4    
    5                log.Debug("Modules: " & ModID.ToString)
    6                log.Debug("BeginDate: " & StartDate.ToString)
    7                log.Debug("EndDate: " & EndDate.ToString)
    8    
    9                Try
    10   
    11                   Dim parms As esParameters = New esParameters()
    12                   parms.Add("Modules", ModID)
    13                   parms.Add("BeginDate", StartDate)
    14                   parms.Add("EndDate", EndDate)
    15   
    16                   Return (Me.ExecuteReader(esQueryType.StoredProcedure, "dbo.dnn_EventsGetByRange", parms))
    17   
    18               Catch ex As Exception
    19                   log.Debug("Error: " & ex.Message)
    20                   Return Nothing
    21               End Try
    22   
    23           End Function
    

    This results in an error:

    2008-02-04 19:35:44,717 DEBUG BusinessObjects.DnnEventsCollection - Modules: 390
    2008-02-04 19:35:44,717 DEBUG BusinessObjects.DnnEventsCollection - BeginDate: 1/22/2008 12:00:00 AM
    2008-02-04 19:35:44,717 DEBUG BusinessObjects.DnnEventsCollection - EndDate: 3/11/2008 12:00:00 AM
    2008-02-04 19:35:44,742 DEBUG BusinessObjects.DnnEventsCollection - Error: Value cannot be null. Parameter name: key

    The SP does work:

    exec dbo.dnn_EventsGetByRange @Modules=N'390',@BeginDate='2008-01-22 00:00:00:000',@EndDate='2008-03-11 00:00:00:000'

    returns 2 rows.

  •  02-04-2008, 12:42 PM 7905 in reply to 7904

    Re: Problem calling Stored Proc

    Solved: registered the wrong connection!

    Should be:

    Code:
                Dim conn As New esConnectionElement()
    
                With conn
                    .Name = "SQL"
                    .ProviderMetadataKey = "esDefault"
                    .SqlAccessType = esSqlAccessType.StoredProcedure
                    .Provider = "EntitySpaces.SqlClientProvider"
                    .ProviderClass = "DataProvider"
                    .ConnectionString = "Data Source=localhost;Initial Catalog=DotNetNuke48;User ID=xxxx;Password=xxxxxxxx"
                    .DatabaseVersion = "2005"
                End With
    
                ' Assign the Default Connection 
                esConfigSettings.ConnectionInfo.Connections.Add(conn)
                esConfigSettings.ConnectionInfo.[Default] = "SQL"

    I had forgotten that I had removed the es entries from the web.config and moved them into my modules.

View as RSS news feed in XML