G
Guest
This has got to be dumb question, but I cannot figure it out.
I am using VS2005, .NET 2, SQL Server Express 2005. I have no trouble
reading records, but the updates to not get persisted to the database.
Why won't this code insert a new record in the EventLog table? Any help
would be great!
CondoTrackerDatabaseDataSet.EventLogDataTable table =
this.EventLogTableAdapter.GetData();
//Rows = 1
MessageBox.Show(table.Rows.Count.ToString());
CondoTrackerDatabaseDataSet.EventLogRow logRow = table.NewEventLogRow();
logRow.EventDate = DateTime.Now;
logRow.RoomNumber = roomNumber;
logRow.EventTypeLabel = eventType.ToString();
logRow.LogText = logText;
//Add Row
table.AddEventLogRow(logRow);
//Rows = 2
MessageBox.Show(table.Rows.Count.ToString());
//Supposedly commits to database
this.EventLogTableAdapter.Update(table);
//Refill table
this.EventLogTableAdapter.ClearBeforeFill = true;
this.EventLogTableAdapter.Fill(table);
//Rows = 1
MessageBox.Show(table.Rows.Count.ToString());
I am using VS2005, .NET 2, SQL Server Express 2005. I have no trouble
reading records, but the updates to not get persisted to the database.
Why won't this code insert a new record in the EventLog table? Any help
would be great!
CondoTrackerDatabaseDataSet.EventLogDataTable table =
this.EventLogTableAdapter.GetData();
//Rows = 1
MessageBox.Show(table.Rows.Count.ToString());
CondoTrackerDatabaseDataSet.EventLogRow logRow = table.NewEventLogRow();
logRow.EventDate = DateTime.Now;
logRow.RoomNumber = roomNumber;
logRow.EventTypeLabel = eventType.ToString();
logRow.LogText = logText;
//Add Row
table.AddEventLogRow(logRow);
//Rows = 2
MessageBox.Show(table.Rows.Count.ToString());
//Supposedly commits to database
this.EventLogTableAdapter.Update(table);
//Refill table
this.EventLogTableAdapter.ClearBeforeFill = true;
this.EventLogTableAdapter.Fill(table);
//Rows = 1
MessageBox.Show(table.Rows.Count.ToString());