error for new row and data sql

Dec 9 2010 3:28 PM

Please help

 I keep getting the following error:  "Object reference not set to an instance of an object."  for the code DataRow myRow = myTable.NewRow();

string connectionString = @"data source = GERHARDVDM28-PC; initial catalog = RacerUI; integrated security=SSPI";
string commandString = @"SELECT * FROM Entries";
SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, connectionString);
SqlCommandBuilder scb = new SqlCommandBuilder(dataAdapter);
DataSet racerUIDataSet = new DataSet();
DataTable myTable = racerUIDataSet.Tables["Entries"];
this.entriesTableAdapter.Fill(this.racerUIDataSet.Entries);
DataRow myRow = myTable.NewRow();
myRow[0] = RacerName;
myRow[1] = BikeManufacturer;
myRow[2] = RaceNumber;
myRow[3] = Team;

myTable.Rows.Add(myRow);

dataAdapter.Update(racerUIDataSet, "Entries");

racerUIDataSet.AcceptChanges();


Answers (4)