我如何在 C# 的 SQL 查询中使用 combobox.selectedvalue
本文关键字:combobox selectedvalue 查询 SQL | 更新日期: 2023-09-27 18:34:19
如何在 C# 的 SQL 查询中使用combobox.SelectedValue
?
using (OracleDB db = new OracleDB())
{
if (name.Checked)
{
DataTable nameDT= db.Select("SELECT name FROM People where name= IN THIS PLACE I NEED SELECTED VALUE FROM COMBOBOX1"), "Osoby");
}
}
using (OracleDB db = new OracleDB())
{
if (name.Checked)
{
var sql = String.Format("Select [name] FROM People WHERE [name] = {0}", comboBox1.SelectedItem.ToString())
var nameDT = db.Select(sql, "Osoby");
}
}
MSDN: ComboBox.SelectedItem Property
使用这个:
"...where name=" + comboBoxName.SelectedValue.ToString()), "Osoby");