I am creating an application in which I am getting some data in my dataGridView1
in my form. I want to access my last row of data in some variables like I want to store columns in variables and use them. I know how to do this in GridView Cell click event but I want to use this in a loop like after every 10 seconds new data comes from database to dataGridView1 and I want last row to be accessed in variables.
Below is the code of how I am loading data in dataGridView
using (var con = new SqlConnection(ConStr))
{
string query = "SELECT * FROM CHECKINOUT";
using (var cmd = new SqlCommand(query, con))
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
}