如何从组合框检索数据 [英] how to retrieve data from combobox
本文介绍了如何从组合框检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从sql检索组合框中的数据,
并在组合框的选定项目填充了许多textBoxes
how to retrieve data in combobox from sql,
and after selecteditems of combobox fill many textBoxes
推荐答案
检查这些并进行应用.
在ComboBox中从数据库填充数据 [ ^ ]
如何使用C#将访问数据库中的数据放入组合框 [ http://stackoverflow.com/Questions/16806062/how-to-fetch-data-from-sql-database-to-combo-box-c-sharp [ http://stackoverflow.com/questions/14968125/retrieve-data-into-combobox [ ^ ]
Check these and apply yourself.
Populate data from database in a ComboBox[^]
how to get data from access database into combobox using c#[^]
http://stackoverflow.com/questions/16806062/how-to-fetch-data-from-sql-database-to-combo-box-c-sharp[^]
http://stackoverflow.com/questions/14968125/retrieve-data-into-combobox[^]
我不确定,您想要什么确切的输出.但您可以尝试以下解决方案:
I am not sure, what exact output you want. but you can try these solutions:
string Text = ComboBox1.Text;
或者您可以使用
Or you can use
int Index = ComboBox1.SelectedIndex;
sttring text = ComboBox1.Items[Index].ToString;
或
OR
DataRow selectedDataRow = ((DataRowView)comboBox1.SelectedItem).Row;
int Id = Convert.ToInt32(selectedDataRow["Id"]);
string Name = selectedDataRow["Name"].ToString();
int selectedValue = Convert.ToInt32(comboBox1.SelectedValue);
这篇关于如何从组合框检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文