这代码哪错了怎么改求解答
Public Class CategorySalesData'declare class level variables
Private aDataSet As ConancoolDataSet
Private CategoriesTableAdapter As ConancoolDataSetTableAdapters.CategoriesTableAdapter
Private Category_Sales_for_1995TableAdapter As ConancoolDataSetTableAdapters.Category_Sales_for_1995TableAdapter
'constructor
Sub New()
'instantiate dataset and table adapter objects
aDataSet = New ConancoolDataSet
CategoriesTableAdapter = New ConancoolDataSetTableAdapters.CategoriesTableAdapter
Category_Sales_for_1995TableAdapter = New ConancoolDataSetTableAdapters.Category_Sales_for_1995TableAdapter
End Sub
'function to fill and return dataset
Public Function getData() As ConancoolDataSet
'fill dataset
CategoriesTableAdapter.Fill(aDataSet.Categories)
Category_Sales_for_1995TableAdapter.Fill(aDataSet.Category_Sales_for_1995)
Return aDataSet
End Function
'procedure to update database
Public Sub updateDatabase(ByVal aDataSet As ConancoolDataSet)
Try
' Update child Deletes.
If aDataSet.Category_Sales_for_1995.GetChanges(DataRowState.Deleted) IsNot Nothing Then
'Get changes for the deleted child rows only.
Dim Category_Sales_for_1995DeleteDataTable As DataTable
Category_Sales_for_1995DeleteDataTable = aDataSet.Category_Sales_for_1995.GetChanges(DataRowState.Deleted)
Category_Sales_for_1995TableAdapter.Update(Category_Sales_for_1995DeleteDataTable)
End If
' Update all parent row Adds, Deletes, and Changes.
If aDataSet.Categories.GetChanges() IsNot Nothing Then
CategoriesTableAdapter.Update(aDataSet.Categories)
End If
' Update child Adds and Edits.
If aDataSet.Category_Sales_for_1995.GetChanges(DataRowState.Added + DataRowState.Modified) IsNot Nothing Then
'Get changes for the added and edited child rows only.
Dim Category_Sales_for_1995AddDataTable As DataTable
Category_Sales_for_1995AddDataTable = aDataSet.Category_Sales_for_1995.GetChanges(DataRowState.Added + DataRowState.Modified)
Category_Sales_for_1995TableAdapter.Update(Category_Sales_for_1995AddDataTable)
End If
aDataSet.AcceptChanges()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
我用的是VB语言,下滑线的是显示出错的地方,可是我是按照书上打的,一模一样就不知道怎么错了。求各位解答