You must Sign In to post a response.
  • Category: LINQ

    How to develop login page with LINQ


    Are you looking for a way to develop login page with LINQ ? then read this thread to know how to develop it



    Hello

    I am new to linq. I want to know regarding how to login with linq query

    I have tried the code but its not working

    lobj.username = UserName.Text;
    lobj.password = Password.Text;
    var query = from s in dobj.tbl_logins
    where s.username == UserName.Text && s.password == Password.Text
    select s.type.ToList();



    I want to fetch the type field and then i have to identify which one is user and which is admin
  • #744314
    Hi Rutul,

    can you try this :


    var query = from s in dobj.tbl_logins
    where s.username == UserName.Text && s.password == Password.Text
    select s.type;

    so, it vl renters the type of valid user.

    good luck,
    Murali.MD

  • #745534
    Hi Rutul Parikh,

    can you try this code..
    var query = from s in dobj.tbl_logins
    where s.username.Equal(UserName.Text) && s.password.Equal(Password.Text)
    select s.type;

    return type value in this table

    good luck
    Surendra sharma

  • #745745
    Hai Rutul,
    If you are using the Where clause with the Linq, in the Collection,you should have the value in the same format and then you can filter it.
    Below is the query which you can use:

    var query = from s in dobj.tbl_logins
    where s.username == UserName.Text
    && s.password == Password.Text
    select new { UserName = s.username, Password = s.password};

    You can also go to the below link where you can find the different uses of the Linq collection:

    http://www.codeproject.com/Articles/286255/Using-LINQ-Queries

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


  • Sign In to post your comments