The close for the connection is embedded within an if condition, move it outside of the if as it will only close if the condition is true and you should close the connection regardless of the condition.
private void button2_Click(object sender, EventArgs e)
{
if(dataGridView1.SelectedRows.Count > 0 && dataGridView1.SelectedRows[0].Index!=dataGridView1.Rows.Count-1)
{
using (OleDbCommand delcmd = new OleDbCommand())
{
delcmd.CommandText = "delete from table123 where Idno=@ID";
delcmd.Connection = con;
delcmd.Parameters.Add("@ID", dataGridView1.SelectedRows[0].Cells[0]);
con.Open();
delcmd.ExecuteNonQuery();
con.close();
}
dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
MessageBox.Show("Row Deleted");
bind();
clear();
}
}
Improved answer, no need to open connection if nothing to do, added proper parameterised string.