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 can i display data in listbox?

how can i display data in listbox?

Scheduled Pinned Locked Moved ASP.NET
questiondatabase
3 Posts 2 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.
  • R Offline
    R Offline
    Rharzkie
    wrote on last edited by
    #1

    i have a database of lists of subjects...then in my module, i want to display all the subjects that i recorded in the listbox... how can i do it? i already connect my dataset in the connection wizard but i can't display it in the listbox.

    C 1 Reply Last reply
    0
    • R Rharzkie

      i have a database of lists of subjects...then in my module, i want to display all the subjects that i recorded in the listbox... how can i do it? i already connect my dataset in the connection wizard but i can't display it in the listbox.

      C Offline
      C Offline
      chathu03j
      wrote on last edited by
      #2

      use the following coding... String sql = "SELECT Category Name FROM Categories"; OleDbConnection con = new OleDbConnection(connectionString); OleDbCommand cmd = new OleDbCommand(sql,con); OleDbDataAdapter da = new OleDbDataAdapter(cmd); DataTable dt =new DataTable(); con.Open(); da.Fill(dt); ListBox1.DataSource = dt; ListBox1.DataBind();

      R 1 Reply Last reply
      0
      • C chathu03j

        use the following coding... String sql = "SELECT Category Name FROM Categories"; OleDbConnection con = new OleDbConnection(connectionString); OleDbCommand cmd = new OleDbCommand(sql,con); OleDbDataAdapter da = new OleDbDataAdapter(cmd); DataTable dt =new DataTable(); con.Open(); da.Fill(dt); ListBox1.DataSource = dt; ListBox1.DataBind();

        R Offline
        R Offline
        Rharzkie
        wrote on last edited by
        #3

        how can i declared all the variables there? will i put in form_load or in listbox1_SelectedIndexChanged???

        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