예제 #1
0
        public string Delete(DeleteUser d)
        {
            string msg = "";

            con.Open();
            SqlCommand cmd = new SqlCommand("Delete UserTab where UserID = @UserID", con);

            cmd.Parameters.AddWithValue("@UserID", d.UID);
            int res = cmd.ExecuteNonQuery();

            if (res == 1)
            {
                msg = "Successfully Deleted";
            }
            else
            {
                msg = "Failed to Deleted";
            }
            return(msg);
        }
예제 #2
0
        public string Delete(DeleteUser d)
        {
            string        msg = "";
            SqlConnection con = new SqlConnection("Data Source=WINDOWS-C8ATAQL;Initial Catalog=CRUD;Persist Security Info=True;User ID=sa; Password=pacitan1");

            con.Open();
            SqlCommand cmd = new SqlCommand("delete UserTab where UserID = @UserID", con);

            cmd.Parameters.AddWithValue("@UserID", d.UID);
            int res = cmd.ExecuteNonQuery();

            if (res == 1)
            {
                msg = "Successfully deleted";
            }
            else
            {
                msg = "Failed to deleted";
            }
            return(msg);
        }