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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:56:28+00:00 2026-05-20T11:56:28+00:00

For a school project we have to create an evaluation website that requires a

  • 0

For a school project we have to create an evaluation website that requires a login.
For the database connection I chose LINQ, because it’s new and is supposed to be easier/better in use.

I managed to create a login check with the following:

public static Boolean Controle(int id, string wachtwoord)
{
    DataClassesDataContext context = new DataClassesDataContext();

    var loginGebruiker =
        from p in dc.Gebruikers
        where p.GebruikerID == id
        where p.GebruikerWachtwoord == wachtwoord
        select p;


    return true;
}

Now I’m trying to create a “forgot password” option, where you enter your id and the password gets returned (later it would be emailed to you, don’t know how I would do this either, suggestions?)

I tried with the following code:

public static string Forgot(int id)
{
    var context = new DataClassesDataContext();

    var wachtwoordLogin = (
        from p in dc.Gebruikers
        where p.GebruikerID == id
        select p.GebruikerWachtwoord);

    return wachtwoordLogin.ToString();
}

Code behind the button on the page:

 lbl1.Text = Class1.Forgot(Convert.ToInt32(txt1.Text));

Now when I enter the an id of the first user (1), lbl1 becomes this:

SELECT [t0].[GebruikerWachtwoord] FROM
[dbo].[Gebruiker] AS [t0] WHERE
[t0].[GebruikerID] = @p0

I don’t know how to solve this and I have been looking everywhere, I hope somebody can help me.

Thanks,
Thomas

  • 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-20T11:56:29+00:00Added an answer on May 20, 2026 at 11:56 am

    LINQ uses delayed execution, so your ‘wachtwoordLogin’ is really just “how to get your data.” Its not until you apply an operator that LINQ will actually attempt to retrieve your data.

    Your first statement:

    var loginGebruiker = (
        from p in dc.Gebruikers
        where p.GebruikerID == id 
        where p.GebruikerWachtwoord == wachtwoord
        select p).FirstOrDefault()
    
    if (loginGeruiker != null) {
       //Valid login
    } else {
       // invalid
    }
    

    FirstOrDefault means, take the first item in the list, or return none.

    In you other case you need the same thing:

     user =  wachtwoordLogin.FirstOrDefault();
    

    Further reading: MSDN 101 LINQ Samples


    For your question about emailing a forgotten password, have you ever thought about implementing the golden questions algorithm instead? Its simplified, and does the same thing.

    Basically, at the time of registering just get them to answer some questions, and if they can verify them, allow them to reset the password.

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

Sidebar

Related Questions

For a school project, I need to create a way to create personnalized queries
I'm just learning to build a website. It's a school project and after I
Using this library, ZXing , we have a project at school in which we'll
Up till now I have been developing my personal and school projects at home
For our school project, we are tasked to define a design document describing the
I'm working on a school project and I'm getting some weird errors from Xcode.
I'm working on a project for school, and I'm implementing a tool which can
I am trying to use Qt for a project in school but am running
At school we have been programming in MIPS assembly language for some time. I'm
For a school assignment I have to write x86 assembly code, except I can't

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.