0
我试图显示表的Oracle数据库在Visual Studio 2012中组合框中的名称,但我不知道它为什么不显示在Oracle数据库中添加表名组合框在Visual Studio 2012
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
con.Open();
OleDbDataAdapter oda = new OleDbDataAdapter("SELECT table_name FROM tabs where table_name Like 'ST%'", con);
DataTable dt = new DataTable();
oda.Fill(dt);
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "table_name";
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex + "");
}
}
您正在应用一个条件'Like'ST%''。你确定有以'ST'开头的表吗? – 2016-02-13 04:41:41
是我测试它在sql它的作品,然后我将它应用在C# –