1
我正在使用下一個代碼。我如何使用選擇C來填充組合框#
public void MostrarCombobox(ComboBox cmbIDart)
{
Command = "SELECT idArtigoAvaliar FROM dbo.PorAvaliasao WHERE (avaliado = 0) AND (idAutor ='" + Autor.id2 + "')";
SqlCommand Comm1 = new SqlCommand(Command, Conn);
SqlDataAdapter data = new SqlDataAdapter(Comm1);
SqlCommand sqlCommand = new SqlCommand();
using (Conn)
{
sqlCommand = Conn.CreateCommand();
sqlCommand.CommandText = Command;
SqlDataAdapter sda = new SqlDataAdapter(sqlCommand.CommandText, Conn);
SqlCommandBuilder scb = new SqlCommandBuilder(sda);
//Criar uma tabela para receber os dados
DataTable dTable = new DataTable();
//Preencher a tabela
sda.Fill(dTable);
BindingSource bSource = new BindingSource();
bSource.DataSource = dTable;
cmbIDart.DataSource = bSource;
Conn.Close();
}
}
我的問題是,當我開始打電話給組合框,它顯示System.Data...
,我希望他們表現出的價值。
我在做什麼錯?
* system.data。(etc)* ...?在提問時你必須更具體一些=) –