Hi, i have issue with my combobox. Everything is working fine but i need my multiple column combobox to display only one column. What i need is when i select one value from it, where one row contain id number and name, to display only the id number. I use database from sql server for filling the combobox.
working in C#.
using (SqlConnection sqlConnection = new SqlConnection("Data Source=MILAN\\SQLEXPRESS;Initial Catalog=sm;Integrated Security=True"))
{
string sql = "sql";
SqlCommand sqlCmd = new SqlCommand(sql, sqlConnection);
sqlConnection.Open();
SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
sqlDa.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
id = dt.Rows[i]["column_1"].ToString();
name = dt.Rows[i]["column_2"].ToString();
newName = id + " | " + name;
}
Comments: Hi! Would you please clarify your question and provide a sample project to us for investigation? Best regards, Fadil
working in C#.
using (SqlConnection sqlConnection = new SqlConnection("Data Source=MILAN\\SQLEXPRESS;Initial Catalog=sm;Integrated Security=True"))
{
string sql = "sql";
SqlCommand sqlCmd = new SqlCommand(sql, sqlConnection);
sqlConnection.Open();
SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
sqlDa.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
id = dt.Rows[i]["column_1"].ToString();
name = dt.Rows[i]["column_2"].ToString();
newName = id + " | " + name;
}
Comments: Hi! Would you please clarify your question and provide a sample project to us for investigation? Best regards, Fadil