Windows - How to remove a row from a database, Remove row from datatable

How to remove a row from a database


The below example code will help you to remove a row from the database.

private void Delete_Record(int prodid)
    {
        DataTable dto = new DataTable();
        dto = ((DataTable)Session["prodDT"]);
for(int i = dto.Rows.Count - 1; i == 0; i--)
{
DataRow r = dto.Rows[i];
 int id = Convert.ToInt32(r["ID"]);
            if (id == prodid)
            {
                dto.Rows.RemoveAt(i);
            }

}

The above code is just an example to remove a row from database.

The topic on Windows - How to remove a row from a database is posted by - Maha

Hope you have enjoyed, Windows - How to remove a row from a databaseThanks for your time

Tech Bluff