如何从数据库检索记录到JComboBox并显示它们? [英] How to retrieve Records from Database to JComboBox And Display them?

查看:215
本文介绍了如何从数据库检索记录到JComboBox并显示它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,您好。



我在Oracle 10g数据库中有一个名为学生的表包含这些列

ID INT PRIMARY KEY,

名称VARCHAR2(50),

地址VARCHAR2(50)



我需要显示名称JComboBox中的学生,同时我需要获得所选学生的ID列值,与.Net ComboBox相同,显示会员和ValueMember Properies。



我该怎么办?是吗?

Hello, friends.

I have a table in Oracle 10g database named students contains these columns
ID INT PRIMARY KEY,
Name VARCHAR2(50),
Address VARCHAR2(50)

I need to display the names of the students in JComboBox and at the same time I need to get the ID column value for the selected students same as .Net ComboBox with DisplayMember and ValueMember Properies.

How can I Do it?

推荐答案

参见 http://docs.oracle.com/javase/7/docs/api/javax/swing/JComboBox.html [ ^ ]。


这篇关于如何从数据库检索记录到JComboBox并显示它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆