Does anyone know how to clear a DaGridView control?
I am binging a DataGridView control in the Load method of a windows form. I then change some data and call an Update method. The data updates but the DataGridView dosn't reflect the changes unless I open and close the form.
Is there a way to refresh the screen without having to open and reclose??
Refresh() doesn't seem to work.
When Form Loads:
Conn = new OleDbConnection(ConStr))
cmd = new OleDbCommand(SQL, Conn))
da = new OleDbDataAdapter())
da.SelectCommand = cmd;
oleDbCb = new OleDbCommandBuilder(da))
dataGridView1.DataSource = dataSet1;
dataGridView1.DataMember = "Stats";
string connectionString = LoginFirst.Connection;
OleDbConnection connection = new OleDbConnection(connectionString);
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "spInsertTrawlT";
command.CommandType = CommandType.StoredProcedure;
OleDbDataReader dr = command.ExecuteReader();
da.InsertCommand = command;
If I call the load method after the Insert method, the DataGridView fills agin but rows are doubled. Is there a method to clear the DataGridView before reloading it??