0

Hi All

Its my first time using LING in vs2008. Im pretty comfortable with do changes to the database (INSERT, UPDATE, DELETE, etc) using LINQ & the DataContext object.

However I'm trying to do a little login page.

A user will enter their login details (username & password) into textboxes. Now I need to be able to find the username in the db and check that the corresponding password matches.

Simple I know. I just wanted to know if LINQ can handle this without me having to use class to store the data first.

i.e. can i use a SELECT statement to fill a string or array and compare it to the textboxes?

Any help/direction will be much appreciated. Also let me know if im not being clear.

Thanks in advance

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by GL.Za
0

Hello

I'm not sure why you need to store the data first. This works for me ...

dim checkLogin = from x in DataContext.table _
        Where x.User = UserName.toString AND x.Password = Password.toString  _
        Select x
if checkLogin.count = 1 then
   ' valid user
else
   ' invalid user
end if

Regards
James

0

Thanks alot James

I was still thinking old school vb & ADO - was messing around with datasets all the time.

Besides that my basic SQL is pretty rusty... guess i will have to brush up in that area.

I will take it further from here
Thanks for the push in the right direction though.

Jody

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.