Solved

Return retval into a datatable in cmdproceed_click

Posted on 2007-03-28
3
242 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
Comment Utility
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
Comment Utility
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
Comment Utility
Dim dt As New DataTable
        dt = _calendar.GetBusinessCalendarPeriod(txtPeriod.Text)
two lines
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now