Wrox Programmer Forums
|
BOOK: Beginning VB.NET Databases
This is the forum to discuss the Wrox book Beginning VB.NET Databases by Thearon Willis; ISBN: 9780764568008
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2005, 01:11 PM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default usp_SelectTimeSheet

While in Chp 12 I received this error while trying to log in as role user
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Operator is not valid for type 'Integer' and type 'DBNull'.

Debugger is pointing to this
error line

  intTotal = intTotal + objTimeSheetDS.Tables( _
                "TimeSheet").Rows(intIndex).Item("MondayHours" )

I think it has got something to do with the usp_SelectTimeSheet. Anyone out there has any clues.

 
Old January 24th, 2005, 06:10 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Hi,

Can you be a little more specific on where the error occurred? Please list the component, class, and method where the error occurred and any circumstances leading up to the error.

Thanks,
Thearon
 
Old January 24th, 2005, 07:17 AM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Thearon, TQ very much for your reply.
I figured that the error occured because there's no items in the TimeSheets and TimeSheetItems table. Have I missed out on the steps for creating them before chapter12?

1)The code is from chapter11 and 12
2)The Form is Timesheet.vb
3)The steps is to create a project and group in the admin form. Then add 3 roles and 4 users as mentioned in page 349. Then quit and run the application but log in as the user created. The program will try to show the Timesheet but quit on the method below.
4)The error occured at the method below
 Private Sub LoadTimeSheet(ByVal WeekEndingDate As ComboBox)
        'Clear previous bindings
        grdTimeSheet.DataSource = Nothing
        grdTimeSheet.DataMember = String.Empty

        'Initialize a new instance of the business logic component
        objTimeSheets = New WroxBusinessLogic.WBLTimeSheets( _
            strCompany, strApplication)

        'Get the timesheet for the user
        objTimeSheetDS = objTimeSheets.GetTimeSheet( _
            New Guid(strUserID), WeekEndingDate.SelectedItem)

        'Set the DataView object with the data from the DataSet
        objTimeSheetDV = New DataView(objTimeSheetDS.Tables("TimeSheet"))

        'Initialize a new DataRowView object
        Dim objDataRowView As DataRowView = objTimeSheetDV.AddNew

        'Set the values in the columns
        objDataRowView("ProjectName") = "Total Hours"

        'Calculate and set the total hours for Monday
        intTotal = 0
        For intIndex = 0 To objTimeSheetDS.Tables("TimeSheet").Rows.Count - 1
Error here ---> intTotal += objTimeSheetDS.Tables( _
                "TimeSheet").Rows(intIndex).Item("MondayHours" )
       ........ End Sub


Thanks,
HGC


 
Old January 25th, 2005, 07:22 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

HGC,

The timesheet data should be created in the Data Access component if it does not retrieve any existing data. Please verify step 7 on page 427 in Chapter 12.

Thearon
 
Old January 27th, 2005, 02:32 AM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Thearon,

Thx for the feedback. I finally found the issue was typo error on my part for the TimeSheet table and also select case Group Project. Now the program works fine.










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.