I have a datagridview in windows form. I have added a timer as well. So in the timer_tick method, I had called a method to retrieve data to the gridview from my Access databse. But now I want to refresh the datagrid view as soon as it updates the table. I have added following code, but it doesn't work. What am I doing wrong?
C#
protected void FillDataGridView() { // create an open the connection
OleDbConnection conn = new OleDbConnection(conString);
OleDbCommand command = new OleDbCommand();
command = conn.CreateCommand();
// create the DataSet DataSet ds = new DataSet();
// run the query command.CommandText = "SELECT * FROM TexasClub";
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter = new OleDbDataAdapter(command);
adapter.Fill(ds); } private void timer1_Tick(object sender, EventArgs e)
{
//Call the FillGridview method FillDataGridView();
}

Anoop Kumar SharmaRank #127 · 17.4K reputationPosted Mar 21, 2015, 8:43 PM EDT
Set the Datasource of DataGridView after adapter.Fill(ds);
I hope this will help you.
You can also read this article:
http://www.c-sharpcorner.com/UploadFile/1e050f/insert-update-and-delete-record-in-datagridview-C-Sharp/
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Mar 21, 2015, 10:22 PM EDT
gridview in
Ekona Pikin38 reputationPosted Mar 22, 2015, 4:23 AM EDT
I wanna meet Pryanka Chopra some day:))
Anoop Kumar SharmaRank #127 · 17.4K reputationPosted Mar 22, 2015, 9:58 AM EDT