mathieu_cupryk
asked on
Procedure 'usp_GetDatePeriodFromTo' expects parameter '@YEARMONTH', which was not supplied.
I am using the enterpriselib 2.0
Public Function GetBusinessCalendarPeriod( ByVal DatePeriod As String) As DataTable
' DatePeriod is the YearMonth
Dim retVal As New DataTable("BusinessCalenda rs")
Dim cmd As DbCommand
Dim tmpds As DataSet
Try
'We get the divisions
cmd = dbManager.GetStoredProcCom mand("SENZ A.dbo.usp_ GetDatePer iodFromTo" )
'Temporarilly put the results in a dataset so we can check for valid data
tmpds = dbManager.ExecuteDataSet(c md)
'We must ensure that only one table was returned in the execution of the query
If tmpds.Tables.Count.Equals( 1) Then
'We also need to ensure that there is data
If tmpds.Tables(0).Rows.Count > 0 Then
retVal = tmpds.Tables(0)
Else
Return retVal
End If
Else
Return retVal
End If
Catch ex As Exception
Throw ex
Finally
'Cleaning up
If Not tmpds Is Nothing Then
tmpds.Dispose()
End If
If Not cmd Is Nothing Then
cmd.Dispose()
End If
End Try
Return retVal
End Function
Procedure 'usp_GetDatePeriodFromTo' expects parameter '@YEARMONTH', which was not supplied.
Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEv entArgs) Handles cmdProceed.Click
_calendar.GetBusinessCalen darPeriod( txtPeriod. Text)
Response.Write("Calendar")
End Sub
Public Function GetBusinessCalendarPeriod(
' DatePeriod is the YearMonth
Dim retVal As New DataTable("BusinessCalenda
Dim cmd As DbCommand
Dim tmpds As DataSet
Try
'We get the divisions
cmd = dbManager.GetStoredProcCom
'Temporarilly put the results in a dataset so we can check for valid data
tmpds = dbManager.ExecuteDataSet(c
'We must ensure that only one table was returned in the execution of the query
If tmpds.Tables.Count.Equals(
'We also need to ensure that there is data
If tmpds.Tables(0).Rows.Count
retVal = tmpds.Tables(0)
Else
Return retVal
End If
Else
Return retVal
End If
Catch ex As Exception
Throw ex
Finally
'Cleaning up
If Not tmpds Is Nothing Then
tmpds.Dispose()
End If
If Not cmd Is Nothing Then
cmd.Dispose()
End If
End Try
Return retVal
End Function
Procedure 'usp_GetDatePeriodFromTo' expects parameter '@YEARMONTH', which was not supplied.
Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEv
_calendar.GetBusinessCalen
Response.Write("Calendar")
End Sub
ASKER
I am new to this EL 2.0 how do I go about doing so?
You can probably change your code to this. I believe this will do it.
cmd = dbManager.GetStoredProcCom mand("SENZ A.dbo.usp_ GetDatePer iodFromTo" )
dbmanager.AddInParameter(c md, "Year and Month", DbType.DateTime, New DateTime(1997, 1, 1))
'Temporarilly put the results in a dataset so we can check for valid data
tmpds = dbManager.ExecuteDataSet(c md)
cmd = dbManager.GetStoredProcCom
dbmanager.AddInParameter(c
'Temporarilly put the results in a dataset so we can check for valid data
tmpds = dbManager.ExecuteDataSet(c
ASKER
Dim retVal As New DataTable("BusinessCalenda rs")
Dim cmd As DbCommand
Dim tmpds As DataSet
Try
'We get the divisions
cmd = dbManager.GetStoredProcCom mand("SENZ A.dbo.usp_ GetDatePer iodFromTo" )
dbManager.AddInParameter(c md, "@YEARMM", DatePeriod)
'Temporarilly put the results in a dataset so we can check for valid data
tmpds = dbManager.ExecuteDataSet(c md)
'We must ensure that only one table was returned in the execution of the query
If tmpds.Tables.Count.Equals( 1) Then
'We also need to ensure that there is data
If tmpds.Tables(0).Rows.Count > 0 Then
retVal = tmpds.Tables(0)
Else
Return retVal
End If
Else
Return retVal
End If
Catch ex As Exception
Throw ex
Finally
'Cleaning up
If Not tmpds Is Nothing Then
tmpds.Dispose()
End If
If Not cmd Is Nothing Then
cmd.Dispose()
End If
End Try
Return retVal
End Function
End Class
Dim cmd As DbCommand
Dim tmpds As DataSet
Try
'We get the divisions
cmd = dbManager.GetStoredProcCom
dbManager.AddInParameter(c
'Temporarilly put the results in a dataset so we can check for valid data
tmpds = dbManager.ExecuteDataSet(c
'We must ensure that only one table was returned in the execution of the query
If tmpds.Tables.Count.Equals(
'We also need to ensure that there is data
If tmpds.Tables(0).Rows.Count
retVal = tmpds.Tables(0)
Else
Return retVal
End If
Else
Return retVal
End If
Catch ex As Exception
Throw ex
Finally
'Cleaning up
If Not tmpds Is Nothing Then
tmpds.Dispose()
End If
If Not cmd Is Nothing Then
cmd.Dispose()
End If
End Try
Return retVal
End Function
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
cmd = dbManager.GetStoredProcCom
'Temporarilly put the results in a dataset so we can check for valid data
tmpds = dbManager.ExecuteDataSet(c