I have an application that I'm currently writing that takes the selected date from a calendar control and populates a datatable with bookings for that date from an access database. The problem I have is that there are not always bookings made so sometimes the datatable contains no rows, if I then try to add a row I get the following error.

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

This I assume is because the datatable has a row count of 0. the question is how do I get around this problem, is there a way to add new rows to an empty data Table ?

The code for adding the row is as follows:

VB Code:
  1. Dim objDataRow As DataRow
  2.  
  3.         objDataRow=objDataSet.Tables("Bookings").NewRow
  4.         objDataRow.Item("Aircraft")=aircraft
  5.         objDataRow.Item("Date")=myDate
  6.         objDataRow.Item("Name")=txtName.Text
  7.         objDataRow.Item("Duration")=txtDuration.Text
  8.  
  9.     objDataSet.Tables("Bookings").Rows.Add(objDataRow)
  10.     objBookingDA.Update(objDataSet,"Bookings")