I am trying to write some data into a .MDF database that has only one table, and it's not updating after I execute this part of the code:
DatabaseDataSet.MyTableRow newRow;
newRow = databaseDataSet.MyTable.NewMyTableRow();
newRow.name = "x";
newRow.level = 100;
newRow.health = 100;
newRow.weapon = "club";
this.databaseDataSet.MyTable.Rows.Add(newRow);
int result = MyTableTableAdapter.Update(databaseDataSet.MyTable);
MessageBox.Show(result.ToString());
I am new to working with SQL databases in C#.
I'm using TableAdapter.Update
to update the MyTable
table in the database, I even tried writing my own query version of Update, and I also tried with the MyTableAdapter.insert
function...and no results. I can successfully read data from a database, but when it comes to writing, I fail hard.