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

  • Home
  • SEARCH
  • 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 812555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:13:19+00:00 2026-05-15T01:13:19+00:00

I am a beginner coder, i am building a project using C# Asp.Net in

  • 0

I am a beginner coder, i am building a project using C# Asp.Net in which i am registering users with a user id, now my question is that how to check that the user id is already exists in the user table or not when user trying to register, i am using sql server 2000?

  • 1 1 Answer
  • 0 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-15T01:13:19+00:00Added an answer on May 15, 2026 at 1:13 am

    Based on the code in your comment, I’d say what you need is a good introductory tutorial on how to query data using ADO.NET, if anyone can recommend one.

    First of all, you can’t just use “username.Text” in your query, the SQL Server knows nothing about your ASP.NET page and it’s “username” TextBox.

    You need to pass a parameter into your SqlCommand (don’t ever build a string like “select * from tbl_userlogin where User_id=” + username.Text, google for “sql injection attack” if you want to know why), like this:

        SqlCommand cmd = new SqlCommand("select * from tbl_userlogin where User_id = @UserID", con);
        SqlParameter param = new SqlParameter();
        param.ParameterName = "@UserID";
        param.Value = username.Text;
        cmd.Parameters.Add(param);
    

    Then, you need to actually execute the command and get an SqlDataReader back from it. You can’t just refer to fields from the database in your C# code, that’s why you’re getting the CS0103 compile error.

        SqlDataReader reader = cmd.ExecuteReader();
    

    Now, your SqlDataReader has the results from the query. Since all you care about is whether or not it found something, you can use the HasRows property to check if it returned anything.

        if (reader.HasRows)
        {
            MessageBox.Show("User Id already exists");
        }
    

    Read up on SqlDataReader – http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx – to learn how to actually access the results if you need to.

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

Sidebar

Related Questions

A beginner's question. I'm building a .swf with Flex Ant. To my .swf I
I'm building a with-source system which I am giving out on the 'net for
I am a beginner to android, i am building a application in which when
I am building a full text search facility for my website coded in asp.net
I am beginner in web development, I am developing a site that allows user
A beginner question, bear with me: I'm just wondering under what circumstances one should
Once again a very beginner-ish question, but here I go: I would like to
I am a beginner in the process of designing and coding a project, I
Once more here I come with a question of s2, I'm a beginner at
I am a beginner to android. I am building an application to work with

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.