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. Need help undestandinf the concept

Need help undestandinf the concept

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-netdatabase
4 Posts 2 Posters 1 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.
  • P Offline
    P Offline
    Pete Newman
    wrote on last edited by
    #1

    Running Vista ( business ) , SQl 2005 and VS 2005 (VB.net) I apoliguise if this is posted in the wrong forum Ok im trying to create an asp.net page that has a 'text' box on it ( no data grid ). in the vb code ( i believe its called code behind ) i have connected to a data source and created a data table - dt .. ( code below ). Ive been looking at lots of different articles and all i manage is to go in circles. Is it possible to write all the 'code behind' and just bind the data to a text box and if so using the code below how can i bind the field Licence to the text box StrLicence Alternatly would it be more productive to look at just the asp code, and if so how can i do the same with out using the Form View Any help would be most appriciated Vb code Dim Conn As SqlConnection = New SqlConnection(connectionString) Try Conn.Open() Response.Write("SQL Connection = " & Conn.State.ToString) Dim Adapter As SqlDataAdapter = New SqlDataAdapter(SelectCommand, Conn) Try Adapter.Fill(dt) Response.Write("Filled Data Table") Catch ex1 As Exception Response.Write(ex1.Message) End Try Catch ex As Exception Response.Write(ex.Message) End Try dt = Nothing Conn.Close() Conn = Nothing

    I really do need help..... all this computer stuff is way over my head !!

    P 1 Reply Last reply
    0
    • P Pete Newman

      Running Vista ( business ) , SQl 2005 and VS 2005 (VB.net) I apoliguise if this is posted in the wrong forum Ok im trying to create an asp.net page that has a 'text' box on it ( no data grid ). in the vb code ( i believe its called code behind ) i have connected to a data source and created a data table - dt .. ( code below ). Ive been looking at lots of different articles and all i manage is to go in circles. Is it possible to write all the 'code behind' and just bind the data to a text box and if so using the code below how can i bind the field Licence to the text box StrLicence Alternatly would it be more productive to look at just the asp code, and if so how can i do the same with out using the Form View Any help would be most appriciated Vb code Dim Conn As SqlConnection = New SqlConnection(connectionString) Try Conn.Open() Response.Write("SQL Connection = " & Conn.State.ToString) Dim Adapter As SqlDataAdapter = New SqlDataAdapter(SelectCommand, Conn) Try Adapter.Fill(dt) Response.Write("Filled Data Table") Catch ex1 As Exception Response.Write(ex1.Message) End Try Catch ex As Exception Response.Write(ex.Message) End Try dt = Nothing Conn.Close() Conn = Nothing

      I really do need help..... all this computer stuff is way over my head !!

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      If all you need is to bind one field from the data base, then filling a datatable may be a bit too much overhead. But, with your above code, you should be able to bind your text box something like: strLicense.text = dt.Rows(0).Items(indexOfYourColumn) I think that's the syntax, don't have anything handy to check it on.

      P 1 Reply Last reply
      0
      • P Paddy Boyd

        If all you need is to bind one field from the data base, then filling a datatable may be a bit too much overhead. But, with your above code, you should be able to bind your text box something like: strLicense.text = dt.Rows(0).Items(indexOfYourColumn) I think that's the syntax, don't have anything handy to check it on.

        P Offline
        P Offline
        Pete Newman
        wrote on last edited by
        #3

        Hi Paddy Thanks for the reply, Thats a way forward for me, tho i must admit i havent made it fully clear on what im trying to do. I onlu used one text box as an example, there will be about 20 in total with some 300 records in the table, which i need to navigate through, hence i was trying to bind to the text box to the table Thanks again, i can now see a way forwards :-D

        I really do need help..... all this computer stuff is way over my head !!

        P 1 Reply Last reply
        0
        • P Pete Newman

          Hi Paddy Thanks for the reply, Thats a way forward for me, tho i must admit i havent made it fully clear on what im trying to do. I onlu used one text box as an example, there will be about 20 in total with some 300 records in the table, which i need to navigate through, hence i was trying to bind to the text box to the table Thanks again, i can now see a way forwards :-D

          I really do need help..... all this computer stuff is way over my head !!

          P Offline
          P Offline
          Paddy Boyd
          wrote on last edited by
          #4

          Buy a book, or read some articles. In all honesty, stumbling along blindly is just going to cause you all manner of problems... Doing a wee bit of proper learning and then coding what you need will probably take you about the same time as bumbling along writing buggy code.

          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