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. Web Development
  3. ASP.NET
  4. how to assign QueryString value to a variable

how to assign QueryString value to a variable

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
14 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.
  • I Imran Khan Pathan

    string id=Request.QueryString["UserID"].ToString(); Best Regard Pathan

    ---------------------------------------------------

    H Offline
    H Offline
    hurrem
    wrote on last edited by
    #3

    I'm sorry, but now it gives me this kind of exception: System.NullReferenceException was unhandled by user code Message="Object reference not set to an instance of an object." Source="App_Web_p-lbdwwh" Thank you

    I 1 Reply Last reply
    0
    • H hurrem

      Hi I have a question: how to assign QueryString value to a variable, that should return unique ID of a user from ASPDBNET table. I used wrote this way: string id=Request.QueryString["UserID"]; but it doesn't assigns any value... :( Thank u

      E Offline
      E Offline
      enjoycrack
      wrote on last edited by
      #4

      what is the url? is this something like yourwebpage.aspx?Userid=??? << >>

      8x Solutions Ltd

      H 1 Reply Last reply
      0
      • E enjoycrack

        what is the url? is this something like yourwebpage.aspx?Userid=??? << >>

        8x Solutions Ltd

        H Offline
        H Offline
        hurrem
        wrote on last edited by
        #5

        yes

        E 1 Reply Last reply
        0
        • H hurrem

          yes

          E Offline
          E Offline
          enjoycrack
          wrote on last edited by
          #6

          Can you put the break point there and debug the code..to see if there is any element in querystring collection or not? << >>

          8x Solutions Ltd

          H 1 Reply Last reply
          0
          • E enjoycrack

            Can you put the break point there and debug the code..to see if there is any element in querystring collection or not? << >>

            8x Solutions Ltd

            H Offline
            H Offline
            hurrem
            wrote on last edited by
            #7

            Yes, it shows the value of UserID, but doesn't assign it

            1 Reply Last reply
            0
            • H hurrem

              Hi I have a question: how to assign QueryString value to a variable, that should return unique ID of a user from ASPDBNET table. I used wrote this way: string id=Request.QueryString["UserID"]; but it doesn't assigns any value... :( Thank u

              P Offline
              P Offline
              Piyush Vardhan Singh
              wrote on last edited by
              #8

              use this one man Dim strcom As String strcom = Request.QueryString.GetValues("CID")(0)

              Piyush Vardhan Singh Programmer TAS NewDelhi India

              H 1 Reply Last reply
              0
              • P Piyush Vardhan Singh

                use this one man Dim strcom As String strcom = Request.QueryString.GetValues("CID")(0)

                Piyush Vardhan Singh Programmer TAS NewDelhi India

                H Offline
                H Offline
                hurrem
                wrote on last edited by
                #9

                Oh, Could you write it in C#, please, couse I'm not familiar with VB at all. Thanx

                P 1 Reply Last reply
                0
                • H hurrem

                  Oh, Could you write it in C#, please, couse I'm not familiar with VB at all. Thanx

                  P Offline
                  P Offline
                  Piyush Vardhan Singh
                  wrote on last edited by
                  #10

                  string strcom = Request.QueryString.GetValues("CID")();

                  Piyush Vardhan Singh Programmer TAS NewDelhi India

                  H N 2 Replies Last reply
                  0
                  • P Piyush Vardhan Singh

                    string strcom = Request.QueryString.GetValues("CID")();

                    Piyush Vardhan Singh Programmer TAS NewDelhi India

                    H Offline
                    H Offline
                    hurrem
                    wrote on last edited by
                    #11

                    It shows me the error: Method name expected

                    H 1 Reply Last reply
                    0
                    • H hurrem

                      It shows me the error: Method name expected

                      H Offline
                      H Offline
                      hurrem
                      wrote on last edited by
                      #12

                      Oh my God, I'm sorry, I've found the error, Thank you guys!

                      1 Reply Last reply
                      0
                      • P Piyush Vardhan Singh

                        string strcom = Request.QueryString.GetValues("CID")();

                        Piyush Vardhan Singh Programmer TAS NewDelhi India

                        N Offline
                        N Offline
                        N a v a n e e t h
                        wrote on last edited by
                        #13

                        Piyush Vardhan Singh wrote:

                        string strcom = Request.QueryString.GetValues("CID")();

                        :confused::confused:


                        My Website | Ask smart questions

                        1 Reply Last reply
                        0
                        • H hurrem

                          I'm sorry, but now it gives me this kind of exception: System.NullReferenceException was unhandled by user code Message="Object reference not set to an instance of an object." Source="App_Web_p-lbdwwh" Thank you

                          I Offline
                          I Offline
                          Imran Khan Pathan
                          wrote on last edited by
                          #14

                          It gives error becoz ur quiry string is null. check condition first if(Request.QueryString["id"]!=null) { code here } Best Regard Pathan

                          ---------------------------------------------------

                          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