Webmatrix Example gives System.NullReferenceException

Discussion in 'Databases' started by arnold2004, Dec 30, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi, I was attempting to implement an example in Webmatrix (editable.aspx). This page is an editable datagrid with update, delete & Add New row features. My issue is when trying to add a row to the table. My table, MyTablehas two columnus MyTableID, MyTableData. I receive the following error:

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.


    Here is the CODE:


    ' add new row to the end of the dataset after binding


    ' first get the data


    Dim myConnection As New OledbConnection(ConnectionString)


    Dim myCommand As New OledbDataAdapter(SelectCommand, myConnection) Dim ds As New DataSet()


    myCommand.Fill(ds) ' add a new blank row to the end of the data


    Dim rowValues As Object() = {"", ""}


    ds.Tables("AssetCategories").Rows.Add(rowValues) '<-- ERROR HERE
    My question is how to take care of the NULL error? Thanks for any help. Arnold
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page