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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. i need query

i need query

Scheduled Pinned Locked Moved Database
database
10 Posts 5 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.
  • B Offline
    B Offline
    bhattiprolu
    wrote on last edited by
    #1

    i have username and password fields in my table, i jus want to write a query to check whether the given details of user matches with the database. please gimme the query:confused:

    P N T 3 Replies Last reply
    0
    • B bhattiprolu

      i have username and password fields in my table, i jus want to write a query to check whether the given details of user matches with the database. please gimme the query:confused:

      P Offline
      P Offline
      Programm3r
      wrote on last edited by
      #2

      Something like (this may not be the best way, but a quick answer to say the least): SELECT * FROM <TABLENAME> WHERE USER = 'JOHN' AND PASS = 'MYPASS' Regards,


      The only programmers that are better that C programmers are those who code in 1's and 0's :bob: :)Programm3r My Blog: ^_^

      B 1 Reply Last reply
      0
      • P Programm3r

        Something like (this may not be the best way, but a quick answer to say the least): SELECT * FROM <TABLENAME> WHERE USER = 'JOHN' AND PASS = 'MYPASS' Regards,


        The only programmers that are better that C programmers are those who code in 1's and 0's :bob: :)Programm3r My Blog: ^_^

        B Offline
        B Offline
        bhattiprolu
        wrote on last edited by
        #3

        not like that........ wat i mean to say is....... i have alogin page where user enters his/her username and password i have to check the data with database and redirect the user to corresponding next page for the i need a query.:doh:

        P C 2 Replies Last reply
        0
        • B bhattiprolu

          not like that........ wat i mean to say is....... i have alogin page where user enters his/her username and password i have to check the data with database and redirect the user to corresponding next page for the i need a query.:doh:

          P Offline
          P Offline
          Programm3r
          wrote on last edited by
          #4

          bhattiprolu wrote:

          i have to check the data with database and redirect the user to corresponding next page for the i need a query

          I cant see what the problem is, because after the select statement you will have all data specific to that user, so redirecting the user to the correct page should be a breeze. Just pass the information of the user to the next page. Unless I'm totlally mis-understanding you. Regards,


          The only programmers that are better that C programmers are those who code in 1's and 0's :bob: :)Programm3r My Blog: ^_^

          B 1 Reply Last reply
          0
          • B bhattiprolu

            not like that........ wat i mean to say is....... i have alogin page where user enters his/her username and password i have to check the data with database and redirect the user to corresponding next page for the i need a query.:doh:

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            bhattiprolu wrote:

            not like that........

            Your original post said:

            i have username and password fields in my table, i jus want to write a query to check whether the given details of user matches with the database. please gimme the query

            What other answer could you expect from that?!

            bhattiprolu wrote:

            i have to check the data with database and redirect the user to corresponding next page for the i need a query.

            You mentioned nothing about login pages or redirecting users. How were we supposed to know, especially since you posted this in the "SQL" forum? If you've got the data and youre question is about ASP.NET post in the appropriate forum.


            -- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website

            1 Reply Last reply
            0
            • P Programm3r

              bhattiprolu wrote:

              i have to check the data with database and redirect the user to corresponding next page for the i need a query

              I cant see what the problem is, because after the select statement you will have all data specific to that user, so redirecting the user to the correct page should be a breeze. Just pass the information of the user to the next page. Unless I'm totlally mis-understanding you. Regards,


              The only programmers that are better that C programmers are those who code in 1's and 0's :bob: :)Programm3r My Blog: ^_^

              B Offline
              B Offline
              bhattiprolu
              wrote on last edited by
              #6

              can u gimme the query.....

              C 1 Reply Last reply
              0
              • B bhattiprolu

                can u gimme the query.....

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                HE DID!! He gave you this: SELECT * FROM <TABLENAME> WHERE USER = 'JOHN' AND PASS = 'MYPASS' But since you've told us nothing about your database structure it may not be correct. If you want more help you'll have to help us understand your problem. Repeating the same statements over and over again do not help. You need to give us more information.


                -- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website

                1 Reply Last reply
                0
                • B bhattiprolu

                  i have username and password fields in my table, i jus want to write a query to check whether the given details of user matches with the database. please gimme the query:confused:

                  N Offline
                  N Offline
                  Nouman Bhatti
                  wrote on last edited by
                  #8

                  SELECT * FROM WHERE USER = 'JOHN' AND PASS = 'MYPASS' this is the write query... now if u r using c# or vb.net get result of this query in datareader and dataadaptor.. if any row returns that means username and password is correct... then redirect to the other page..

                  1 Reply Last reply
                  0
                  • B bhattiprolu

                    i have username and password fields in my table, i jus want to write a query to check whether the given details of user matches with the database. please gimme the query:confused:

                    T Offline
                    T Offline
                    T EDY
                    wrote on last edited by
                    #9

                    They Already gave u the right Query..if u're try to implement that query in your apps just change the where value, ex : Select * From [my_table] WHERE username = '" +UserText.Text+ "' AND password = '" +PasswdText.Text+ "' wat else do u need they gave u the right query u need:-D

                    Regards, Tomi

                    C 1 Reply Last reply
                    0
                    • T T EDY

                      They Already gave u the right Query..if u're try to implement that query in your apps just change the where value, ex : Select * From [my_table] WHERE username = '" +UserText.Text+ "' AND password = '" +PasswdText.Text+ "' wat else do u need they gave u the right query u need:-D

                      Regards, Tomi

                      C Offline
                      C Offline
                      Colin Angus Mackay
                      wrote on last edited by
                      #10

                      TomiEdy wrote:

                      Select * From [my_table] WHERE username = '" +UserText.Text+ "' AND password = '" +PasswdText.Text+ "'

                      Then get ready for a SQL Injection Attack with code like that! Please read: SQL Injection Attacks and Tips on How to Prevent Them[^]


                      -- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website

                      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