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. querying a Acces DataBase

querying a Acces DataBase

Scheduled Pinned Locked Moved Database
databasequestion
2 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.
  • B Offline
    B Offline
    Binary0110
    wrote on last edited by
    #1

    I posted this question before bit I think I may have asked it wrong. I want to set up a program to query 1 field in the DB by pressing a button and then displaying the results in a listbox. At which point I can click in the listbox and display the record in the textboxes. BINARY

    B 1 Reply Last reply
    0
    • B Binary0110

      I posted this question before bit I think I may have asked it wrong. I want to set up a program to query 1 field in the DB by pressing a button and then displaying the results in a listbox. At which point I can click in the listbox and display the record in the textboxes. BINARY

      B Offline
      B Offline
      beatles1692
      wrote on last edited by
      #2

      if you are showing an ID field in your list you can use the id ( whenever is selected by the user) and select the record and then show its field in your text boxes. for example: using System.Data; using System.Data.OleDb; public void listbox_click(object sender,EventArgs e) { string selecet_string="SELECT * FROM MyTable WHERE id="+listbox.selectedItem.ToString(); DataSet ds=new DataSet(); OleDbDataAdapter adapter=new OleDbDataAdapter(select_string,cnn) //you should pass your own connection object. adapter.Fill(ds); //Then you can fill the text boxes textBox1.Text=ds.Tables[0].Rows[0][0].ToString(); //etc. }

      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