Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to write the querry at the login with user name given but password is null

how to write the querry at the login with user name given but password is null

Scheduled Pinned Locked Moved ASP.NET
csharpdatabaseasp-netsql-serversysadmin
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    developerit
    wrote on last edited by
    #1

    Hi , iam using asp.net2.0 with c# with backend sql server 2000. in my database some user dosent have password (null) and some user having password .when iam checking the user it is giving message invalid user or password. can you correct my querry which helps me

    SqlCommand cmd = new SqlCommand("select * from Usersprogrammer where UserName='" + txtusername.Text + "' and OrPassword='"+txtpassword.Text+"'", con);

    E T 2 Replies Last reply
    0
    • D developerit

      Hi , iam using asp.net2.0 with c# with backend sql server 2000. in my database some user dosent have password (null) and some user having password .when iam checking the user it is giving message invalid user or password. can you correct my querry which helps me

      SqlCommand cmd = new SqlCommand("select * from Usersprogrammer where UserName='" + txtusername.Text + "' and OrPassword='"+txtpassword.Text+"'", con);

      E Offline
      E Offline
      Eduard Keilholz
      wrote on last edited by
      #2

      This should do the trick if I understand your question correctly

      string sQuery = "SELECT * FROM Usersprogrammer where ((UserName = '" + txtusername.Text + "') and ((OrPassword is null) or (OrPassword = '" + txtpassword.Text + "')))"

      .: I love it when a plan comes together :. http://www.zonderpunt.nl

      D 1 Reply Last reply
      0
      • D developerit

        Hi , iam using asp.net2.0 with c# with backend sql server 2000. in my database some user dosent have password (null) and some user having password .when iam checking the user it is giving message invalid user or password. can you correct my querry which helps me

        SqlCommand cmd = new SqlCommand("select * from Usersprogrammer where UserName='" + txtusername.Text + "' and OrPassword='"+txtpassword.Text+"'", con);

        T Offline
        T Offline
        Tej Aj
        wrote on last edited by
        #3

        check this post http://opexsolution.com/forum/viewtopic.php?f=15&t=60&p=182#p182[^]

        1 Reply Last reply
        0
        • E Eduard Keilholz

          This should do the trick if I understand your question correctly

          string sQuery = "SELECT * FROM Usersprogrammer where ((UserName = '" + txtusername.Text + "') and ((OrPassword is null) or (OrPassword = '" + txtpassword.Text + "')))"

          .: I love it when a plan comes together :. http://www.zonderpunt.nl

          D Offline
          D Offline
          developerit
          wrote on last edited by
          #4

          thanks for code project team ...... this logic helps me

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups