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

Recommended Answers

All 2 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.