Last post Dec 18, 2016 10:05 PM by markfitzme
Dec 18, 2016 07:10 PM|StarsFlyInArizona|LINK
I have tried the below syntax, but it gives me an error of error column 'empname' does not belong to table
What do I need to change in order to ad an all to my combobox?
public void GetData()
using (SqlConnection conn = new SqlConnection(SqlConnection))
SqlDataAdapter da = new SqlDataAdapter("select [empname] from [Testdb].[dbo].[Test] order by [empname] Asc", conn);
DataRow row = dt.NewRow();
row["empname"] = "All";
cboemployees.DataSource = dt;
Dec 18, 2016 10:05 PM|markfitzme|LINK
First, what is dt? You fill the dataset, but you don't appear to be referencing the datatable created in it anywhere. Instead of dt, try ds.Tables.