I have two ListBoxes
and one ComboBox
in my forms application. I want to add the current selected item from all 3 of them (two ListBoxes
and one ComboBox
)to a new TextBox
. However, I'm getting the column name as:
SYSTEM.DATA.DATAROWVIEW
Here's the code I'm using:
private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
{
string cmdstr = @"select * from information_schema.columns where table_name = '" + comboBox1.SelectedItem + "'";
string conStr = @"Data Source=INPDDBA027\NGEP;Initial Catalog=Dev_Server;Integrated Security=True";
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(cmdstr, conStr);
sda.Fill(dt);
//listBox2.DataSource = dt;
//listBox2.DisplayMember = "Column_Name";
textBox2.CharacterCasing = CharacterCasing.Upper;
textBox2.Text = (listBox1.SelectedItem.ToString() + " " + listBox2.SelectedItem.ToString() + " FROM " + comboBox1.SelectedItem.ToString());
}
Please help.