Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4270976
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:22:45+00:00 2026-05-21T07:22:45+00:00

I have used the standard user tables that ASP.net setup and I’m looking to

  • 0

I have used the standard user tables that ASP.net setup and I’m looking to be able to delete users. To do this first off I need to delete the user id from a table called memberships and then delete the user. To do this I have 2 text boxes setup one for user id and other for user name.

Any ideas of a T-SQL statement that will delete the membership user id first and then move onto the delete username this is my statement so far

else
{
   try
   {
      connection.Open();
      cmd = new SqlCommand("DELETE from Membershio
                            WHERE UserId ='" + deleteuserIDbox.Text + "'", connection);
      cmd = new SqlCommand("DELETE from Users WHERE UserName ='" + deleteuserbox.Text + "'", connection);
      cmd.ExecuteNonQuery();
      update.Text = "Your data has been removed";
   }
   catch
   {
      update.Text = "Your data has not been deleted";
   }
}

The two tables are related hence I need to delete the user id first and then the username

any help greatly appricated

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:22:46+00:00Added an answer on May 21, 2026 at 7:22 am

    If understand it right, your input method has serious issues.

    For example,

    UserID   UserName
     1        testUser
     2        testUser2 
    

    With the logic in your application; I can enter “1” into deleteuserIDbox and “testUser2” into deleteuserbox which in turn would remove userID 1 but not username “testUser”.

    If you didn’t do it already, you need to associate those two tables using Foreign Key on UserID. So the linkage is persisted with UserID field.

    Another issue is, you are directly executing the query with the input from user thus enabling the possiblity of sql injection.

    About your query, you can put ” cmd.ExecuteNonQuery();” between your two cmd statements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used to have a standard ASP.NET MVC 3 application that was Ninject-wired via
I've used databases in asp.net but I now have a situation where I need
We have a small .NET web application (aspx & ascx) that is used inside
I have used all the Standard Network related code for Getting Images of about
I have used CAPTCHA on my various web sites in the standard manner where
To localitie items in the standard directories, I have just used either one of
I used to have my permalinks to standard format, something like http://example.com/?page_id=2 . Now
I'm pretty new into asp.net, and currently I have the need for storing various
I have a fairly standard star voting functionality in my app that uses jQuery's
I have used gmail countless times and was wondering if there are standard patterns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.