DataGridView not displaying a row after it is created
- by joslinm
Hi, I'm using Visual Studio 10 and I just created a Database using SQL Server CE. Within it, I made a table CSLDataTable and that automatically created a CSLDataSet & CSLDataTableTableAdapter.
The three variables were automatically created in my MainWindow.cs class:
cSLDataSet
cSLDataTableTableAdapter
cSLDataTableBindingSource
I have added a DataGridView in my Form called dataGridView and datasource cSLDataTableBindingSource.
In my MainWindow(), I tried adding a row as a test:
public MainWindow()
{
InitializeComponent();
CSLDataSet.CSLDataTableRow row = cSLDataSet.CSLDataTable.NewCSLDataTableRow();
row.File_ = "file";
row.Artist = "artist11";
row.Album = "album";
row.Save_Structure = "save";
row.Sent = false;
row.Error = true;
row.Release_Format = "release";
row.Bit_Rate = "bitrate..";
row.Year = "year";
row.Physical_Format = "format";
row.Bit_Format = "bitformat";
row.File_Path = "File!!path";
row.Site_Origin = "what";
cSLDataSet.CSLDataTable.Rows.Add(row);
cSLDataSet.AcceptChanges();
cSLDataTableTableAdapter.Fill(cSLDataSet.CSLDataTable);
cSLDataTableTableAdapter.Update(cSLDataSet);
dataGridView.Refresh();
dataGridView.Update();
}
In regards to the DataSet methods I tried calling, I had been trying to find a "correct" way to interact with the adapter, dataset, and datatable to successfully show the row, but to no avail.
I'm rather new to using SQL Server CE Database, and read a lot of the MSDN sites & thought I was on the right track, but I've had no luck.
The DataGridView shows the headers correctly, but that new row does not show up.