Пример #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        //DataTable bookInformation = new DataTable();
        //try
        //{
        //    conn = new SqlConnection(SQLConnectionString.getConnectionString());


        //    command = new SqlCommand();
        //    command.Connection = conn;
        //    string storedProc = "spDeleteBook";
        //    command.CommandText = storedProc;
        //    command.CommandType = CommandType.StoredProcedure;
        //    command.Parameters.AddWithValue("@Title", ddlBooksList.SelectedItem.Text.ToString());

        //    conn.Open();
        //    command.ExecuteNonQuery();



        //}
        //catch (SqlException sqlErr)
        //{
        //    Debug.Write(sqlErr.Message);
        //    Debug.Write(sqlErr.StackTrace);
        //}
        //catch (Exception excpt)
        //{
        //    Debug.Write(excpt.Message);
        //    Debug.Write(excpt.StackTrace);
        //}
        //finally
        //{
        //    conn.Close();
        //}

        DatabaseProcedures db = new DatabaseProcedures();

        db.Delete(ddlBooksList.SelectedItem.Text.ToString());
    }