• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

pulling the table names from a Database

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
The code below displays 2 comboBoxes and puts the data from each table into the pull downs. How can I get it so that the first comboBox displays all the tables in my dataBase and the second comboBox dispalys the column names from the table the user has selected from the first comboBox?
Thanks
ben
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at DatabaseMetaData. The method getTables will return the information for your first listbox. The method getColumns will return the information for your second listbox based on the table selected in the first list.
Tom Blough
 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tom Blough:
Have a look at DatabaseMetaData. The method getTables will return the information for your first listbox. The method getColumns will return the information for your second listbox based on the table selected in the first list.
Tom Blough


Hi Tom,
I have been able to get the table names fro the Database with this code

But when I am having trouble to get the Column names from the table the user has selected, could you help me with this part please.
Thanks
ben
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben,
See if this helps:

[ March 10, 2004: Message edited by: Tom Blough ]
reply
    Bookmark Topic Watch Topic
  • New Topic