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 8802575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:07:15+00:00 2026-06-14T01:07:15+00:00

I found this site which was describing a very simple user authentication for LINQ

  • 0

I found this site which was describing a very simple user authentication for LINQ to SQL as at codesamplez.com.

My data in the Database looks like this

| id  | name | password |
+-----+------+----------+
| 1   | tic  | test     |
| 2   | tac  | test     |
| 3   | toe  | test     |

For some strange reason the data doesnt validate as I expect, when I call

 bool b  = IsValidUser("tic" , "test");

this returns FALSE,
But any time I pass the same Username and password combination

 bool b  = IsValidUser("tic" , "tic");

or

 bool b  = IsValidUser("a" , "a");

or

 bool b  = IsValidUser("b" , "b");

it returns true!

below is the code which is basically identical to the referenced page.

public bool IsValidUser(string userName, string passWord)
{
    DataClasses1DataContext db = new DataClasses1DataContext();
    var users = from u in db.Users
                      where u.name == userName
                      && u.password == passWord
                      select u;

    return Enumerable.Count(users) > 0;
}

Update:
The User class:

[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Users")]
public partial class User
{
    private int _id;
    private string _name;
    private string _password;

    public User()
    {
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_id", DbType="Int NOT NULL")]
    public int id
    {
        get
        {
            return this._id;
        }
        set
        {
            if ((this._id != value))
            {
                this._id = value;
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_name", DbType="NChar(10)")]
    public string name
    {
        get
        {
            return this._name;
        }
        set
        {
            if ((this._name != value))
            {
                this._name = value;
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_password", DbType="NChar(10)")]
    public string password
    {
        get
        {
            return this._password;
        }
        set
        {
            if ((this._password != value))
            {
                this._password = value;
            }
        }
    }
}
  • 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-06-14T01:07:16+00:00Added an answer on June 14, 2026 at 1:07 am

    Thanks everyone, all very helpful info now. It was my own mistake here, the Database didnt have the data I expected in it. I had 2 database servers and the new data hadnt replicated over to the development server.

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

Sidebar

Related Questions

I found this site: http://www.os-forum.com/minix/boot/ which claims to document the boot sequence of Minix.
I am trying to implement a generic repository pattern. I found this site which
I found this interesting site, that helps me understand derivatives, http://www.numberempire.com/derivatives.php , It seems
I'm working on a sample i found on this site: http://kevinmusselman.com/blog/2009/02/access-webcam-with-flash/ it captures the
I have found this question in the one site which was about counting sort
I'm trying to speed up my site and found this site: http://www.computingunleashed.com/speed-up-wordpress-ultimate-guide-to-make-sites-super-fast.html , which
I found this site is just what I need. http://www.freeingweb.com/ I want to build
I found a question on this site which showed me how to call a
I have found this site very useful for all my previously faced problems, However
I have a web site which uses one SQL database but the hosting company

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.