如何将数据检索到JComboBox中 [英] How to Retrive the data into the JComboBox

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

问题描述

先生您好,
如何将在MSSQL中创建的单列检索到JComboBOx中.
我知道要在程序中创建字符串数组,我可以将许多字符串传递给对象,并且可以在JComboBox下拉列表中显示相同的字符串.但是,如果在MSSQL的单个列中存在许多名称,我们将无法在程序中声明所有字符串.
因此,如何将单列检索到JComboBox.如何解决此问题,请帮我.



如果有人知道,请帮助我.


谢谢&问候
Pradeep CBZ

Hello sir,
How to Retrive the single column created in MSSQL into the JComboBOx.
I know to create string array in program within that i can pass the many strings to objects and i can display the same in the JComboBox dropdown. But if many names were present in single column in MSSQL ,We cant declare all the strings in the program.
So how to retrive the single column into JComboBox.How to resolve this ,plz do help me..




Plz help me,if any one knows about this.


Thanks & Regards
Pradeep CBZ

推荐答案

如何将数据库项提取到字符串中并使用
How about Extracting the database items to a string and using the addItem()[^] method?


嗯,理查德,我想问题更多是关于查询答案字符串中的值,需要将这些值分开以使其适合字符串[].

Pradeep,您应该使用
StringTokenizer [教程ComboBox [^ ]
hmm, Richard, I think the question is more about values in Query answer String that need to be separated to make them fit into an String[].

Pradeep, you should use StringTokenizer[^] for that.
Also can you use more complex types in your JComboBox, so you might weant to read how to: Tutorial on ComboBox[^]


这篇关于如何将数据检索到JComboBox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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