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. Can we bind datareader to textboxes?

Can we bind datareader to textboxes?

Scheduled Pinned Locked Moved ASP.NET
csstutorialquestion
7 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.
  • L Offline
    L Offline
    lavanya_satheesh
    wrote on last edited by
    #1

    I found out we could bind datareader to grid, dropdown list etc. but can we bind datareader to textboxes? if it is possible how to do it?

    M T 2 Replies Last reply
    0
    • L lavanya_satheesh

      I found out we could bind datareader to grid, dropdown list etc. but can we bind datareader to textboxes? if it is possible how to do it?

      M Offline
      M Offline
      mnaveed
      wrote on last edited by
      #2

      i dont think so you can bind to textbox. you can set the value from reader to textbox. Nav.

      T 1 Reply Last reply
      0
      • L lavanya_satheesh

        I found out we could bind datareader to grid, dropdown list etc. but can we bind datareader to textboxes? if it is possible how to do it?

        T Offline
        T Offline
        Tirthadip
        wrote on last edited by
        #3

        hi, yes you can bind textboxes to a datareader. A textbox can be bounded with one record of a datareader object like that..... //make connection,command object then.... Connection.Open(); reader=SqlCommand.ExecuteReader(); reader.Read(); TextBox1.Text =reader.GetString(1); Tirtha Live life to the fullest

        1 Reply Last reply
        0
        • M mnaveed

          i dont think so you can bind to textbox. you can set the value from reader to textbox. Nav.

          T Offline
          T Offline
          Tirthadip
          wrote on last edited by
          #4

          hi nav, yes you are partially right. actually the problem arises when the datareader has null values.Isnt it? Other wise do u think that the following code is incorrect. txtName.text=reader("Name") whats ur opinion? Tirtha Live life to the fullest

          M 1 Reply Last reply
          0
          • T Tirthadip

            hi nav, yes you are partially right. actually the problem arises when the datareader has null values.Isnt it? Other wise do u think that the following code is incorrect. txtName.text=reader("Name") whats ur opinion? Tirtha Live life to the fullest

            M Offline
            M Offline
            mnaveed
            wrote on last edited by
            #5

            completley agree with you its ok if we not getting any null values. and we can set a check for null as wel. but if we look at the question its not binding its jus a way to getting and setting a value to textbox. regards Nav.

            T 1 Reply Last reply
            0
            • M mnaveed

              completley agree with you its ok if we not getting any null values. and we can set a check for null as wel. but if we look at the question its not binding its jus a way to getting and setting a value to textbox. regards Nav.

              T Offline
              T Offline
              Tirthadip
              wrote on last edited by
              #6

              hi nav, Ok Ok.agree with u. now its settled. Tirtha :laugh::laugh::laugh:The best prophet of the future is the past Live life to the fullest

              M 1 Reply Last reply
              0
              • T Tirthadip

                hi nav, Ok Ok.agree with u. now its settled. Tirtha :laugh::laugh::laugh:The best prophet of the future is the past Live life to the fullest

                M Offline
                M Offline
                mnaveed
                wrote on last edited by
                #7

                thats like a good boy.:rose: take care Nav.

                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