Users Pricing

forum

Home Forums Deleting multiple rows from a table – MindStick

Deleting multiple rows from a table

Aaron Douglas 1982 28 Sep 2013

I have a table and I want to delete all rows with a specific card serial . There are multiple rows with the same card serial .So I wrote this code but it seems that's not working:

try

{
using (SqlConnection con = new SqlConnection(WF_AbsPres.Properties.Settings.Default.DbConnectionString))
{
   con.Open();
   SqlCommand command2 = new SqlCommand("DELETE FORM DevInOut where Cardserial='" + textBox5.Text + "'", con);
   command2.ExecuteNonQuery();
   con.Close();
}
}
   catch (SqlException ex)
{
}

how can assure all the rows will be deleted . Should I use procedure? How do I use procedure?


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md