Solved

Return retval into a datatable in cmdproceed_click

Posted on 2007-03-28
3
245 Views
Last Modified: 2012-05-05
     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.ImageClickEventArgs) Handles cmdProceed.Click
              _calendar.GetBusinessCalendarPeriod(txtPeriod.Text)
         End Sub
         
         
         I have to define a datatable in the cmdProceed to get the information from    _calendar.GetBusinessCalendarPeriod(txtPeriod.Text)

         --------------------------------------------------------------------------------------------------------
         Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdProceed.Click
           Dim dt As Datatable
                             _calendar.GetBusinessCalendarPeriod(txtPeriod.Text)
              What do I do here.
                   

      
           End Sub
          
           ------------------------------------------------------------------------------------------------------
       Public Function GetBusinessCalendarPeriod(ByVal DatePeriod As String) As DataTable
      
                   Dim retVal As New DataTable("BusinessCalendars")
      
                   Dim cmd As DbCommand
                   Dim tmpds As DataSet
      
                   Try
                       'We get the divisions
                       cmd = dbManager.GetStoredProcCommand("SENZA.dbo.usp_GetDatePeriodFromTo")
      
                       dbManager.AddInParameter(cmd, "@YEARMONTH", DbType.String, DatePeriod)
                      
                       'Temporarilly put the results in a dataset so we can check for valid data
                       tmpds = dbManager.ExecuteDataSet(cmd)
      
                       '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
-------------------------------------------------------------------
0
Comment
Question by:mathieu_cupryk
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 18811507
Private Sub cmdProceed_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdProceed.Click
           Dim dt As new Datatable =_calendar.GetBusinessCalendarPeriod(txtPeriod.Text)
         
           
       
           End Sub
0
 

Author Comment

by:mathieu_cupryk
ID: 18815043
Error      108      End of statement expected.      C:\SourceControl_mcupryk\InHouseDev\APPS\MKT0003 - CustomerList\src\CustomerList\MainPage.aspx.vb      58      33      http://localhost/CustomerList/
End of statement expected.?
0
 

Author Comment

by:mathieu_cupryk
ID: 18815061
Dim dt As New DataTable
        dt = _calendar.GetBusinessCalendarPeriod(txtPeriod.Text)
two lines
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question