C# Database Log in

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newkhan
    New Member
    • Oct 2007
    • 35

    C# Database Log in

    Hi Experts,

    I am using login mechanism in my currently developed software but i am confused to use the SQL query for login attempt.

    SELECT * FROM <tablename> WHERE id="<login>" AND password="<pass word>";

    Now tell me how to check that whether any value come in dataset in result of the above query.

    Thanx.
  • mzmishra
    Recognized Expert Contributor
    • Aug 2007
    • 390

    #2
    what is your confusion.
    please explain more

    Comment

    • newkhan
      New Member
      • Oct 2007
      • 35

      #3
      Hi,

      I want to get know that in result of execution of the above query, values (id,password) will go on DataSet but i want to enquire that how can i check that any value come in DataSet or not if no correct login information will be sent by user then i will display the error message for the user.
      Hope now u will understand.
      Thanx.

      Comment

      • mzmishra
        Recognized Expert Contributor
        • Aug 2007
        • 390

        #4
        ok you can do like this
        if(Dataset.tabl es(0).rows.coun t==0) then

        Comment

        • Shashi Sadasivan
          Recognized Expert Top Contributor
          • Aug 2007
          • 1435

          #5
          Originally posted by mzmishra
          ok you can do like this
          if(Dataset.tabl es(0).rows.coun t==0) then
          and equivalent in c#
          Code:
          if(myDataset.Tables[0].Rows.Count == 0)
          {
             //nothing found
          }

          Comment

          Working...