mathieu_cupryk
asked on
Return retval into a datatable in cmdproceed_click
I have the following datatable that is returned.
Period_NBR BEGIN_PRD END_PRD
200606 07/02/2006 12:00:00 AM 07/29/2006 12:00:00 AM
Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEv entArgs) Handles cmdProceed.Click
_calendar.GetBusinessCalen darPeriod( txtPeriod. Text)
End Sub
I have to define a datatable in the cmdProceed to get the information from _calendar.GetBusinessCalen darPeriod( txtPeriod. Text)
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------
Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEv entArgs) Handles cmdProceed.Click
Dim dt As Datatable
_calendar.GetBusinessCalen darPeriod( txtPeriod. Text)
What do I do here.
End Sub
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
Public Function GetBusinessCalendarPeriod( ByVal DatePeriod As String) As DataTable
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, "@YEARMONTH", DbType.String, 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
-------------------------- ---------- ---------- ---------- ---------- -
Period_NBR BEGIN_PRD END_PRD
200606 07/02/2006 12:00:00 AM 07/29/2006 12:00:00 AM
Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEv
_calendar.GetBusinessCalen
End Sub
I have to define a datatable in the cmdProceed to get the information from _calendar.GetBusinessCalen
--------------------------
Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEv
Dim dt As Datatable
_calendar.GetBusinessCalen
What do I do here.
End Sub
--------------------------
Public Function GetBusinessCalendarPeriod(
Dim retVal As New DataTable("BusinessCalenda
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
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dim dt As New DataTable
dt = _calendar.GetBusinessCalen darPeriod( txtPeriod. Text)
two lines
dt = _calendar.GetBusinessCalen
two lines
ASKER
End of statement expected.?