private void dataGridView1_CellEndEdit_1(object sender, DataGridViewCellEventArgs e)
{
string connectionString = null;
connectionString = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
con.ConnectionString = connectionString;
string medicinename = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["Medicine_name"].Value);
DateTime Expiry_Date = Convert.ToDateTime (dataGridView1.Rows[e.RowIndex].Cells["Expiry_Date"].Value);
con.Open();
cmd = new OleDbCommand("select Expiry_Date from Medicine_Available_Detail where Medicine_Name='" + medicinename + "'", con);
OleDbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Expiry_Date = Convert.ToDateTime (dr.GetValue(5));// exeception coming on this line
}
con.Close();
}