예제 #1
0
        public string Delete(DeleteUser d)
        {
            string        msg = "";
            SqlConnection con = new SqlConnection("Data Source=LAPTOP-E77BQ7S0;Initial Catalog=WcfService2;User ID=sa;Password=123;Pooling=False");

            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 delete";
            }
            return(msg);
        }
예제 #2
0
        public string Delete(DeleteUser d)
        {
            string        msg = "";
            SqlConnection con = new SqlConnection("Data Source=DESKTOP-M66THJ5;Initial Catalog=MyTestDB;Persist Security Info=True;User ID=sa;Password=12345;Pooling=False");

            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 delete";
            }
            return(msg);
        }