LoadTimeSheet
Dear Sir/Madam:
I am Pisith Oum, a beginner to programming. I completely finished all Try It Out from Chapter 1 to 11. Everything worked perfectly (no error) when I run the application that I have built by following the instructions from the book. However, when I completed the Try It Out (Implementing Login and Timesheet Functionality, Page 394) in Chapter 12 and test the application again I encounter the error(s) during debugging mode as "Operator '+' is not defined for type 'Integer' and type 'DBNull'." in the following line of bold code text below:
Private Sub LoadTimeSheet(ByVal WeekEndingDate As ComboBox)
'Clear previous bindings
grdTimeSheet.DataSource = Nothing
grdTimeSheet.DataMember = String.Empty
grdTimeSheet.Columns.Clear()
'Initialize a new instance of the business logic component
Using objTimeSheets As 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 Data.DataView(objTimeSheetDS.Tables("TimeSheet"))
'Initialize a new DataRowView object
Dim objDataRowView As Data.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
intTotal += objTimeSheetDS.Tables( _
"TimeSheet").Rows(intIndex).Item("MondayHours" )
Next
..........................
End Sub
I am trying to fixed the problem many days, but cannot.
Would you please help me to solve this issue.
|