locked
Delete Query in SQL server using C# RRS feed

  • Question

  • Sample table "FileDetails"

    DataID  FileName   Author

    1102      temp.txt   xxxx

    String

    query1 = "DELETE FROM FileDetails WHERE FileName='" + item + "'";

           

    SqlConnection con1 = new SqlConnection(WebConfigurationManager.ConnectionStrings["myConnection1"].ToString());

            con1.Open();

           

    SqlCommand cmd1 = new SqlCommand(query1, con1);

           

    int count = cmd1.ExecuteNonQuery();

           

    if (count == 1)

            {

               

    MessageBox.Show("File Deleted");

            }

    Saturday, March 22, 2014 7:44 AM

All replies

  • That record is not get deleted it does not made any changes in the table
    Saturday, March 22, 2014 7:45 AM