I know there is a very long list of questions on the same theme but I couldn't find my answer. So I want to add a combobox column to my DataGridView. I've built in SQL a SP that returns an ID
/DisplayValue
. Here is the query/the result set.
So now in VS I've built a ds with few procedures.
Now I've added the column with the following settings.
My big dataset column IDCategorie returns
So when I try to run this query on formLoad to see my data.
cmd = new SqlCommand("spProduse_Show", conn);
cmd.CommandType = CommandType.StoredProcedure;
try
{
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
DataTable dtProduse = new DataTable();
sda.Fill(dtProduse);
spProduseShowBindingSource.DataSource = dtProduse;
dataGridView1.DataSource = spProduseShowBindingSource;
sda.Update(dtProduse);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
and I get the error from the title, any ideas? I've done the same thing with an other column and everything works fine, but for some reason for this one it doesn't, and I can't figure it out.
Also VS added this 2 lines in form_Load
event
// TODO: This line of code loads data into the 'dsProduse.spLK_CategoriiProduse' table. You can move, or remove it, as needed.
this.spLK_CategoriiProduseTableAdapter.Fill(this.dsProduse.spLK_CategoriiProduse);
// TODO: This line of code loads data into the 'dsProduse.spLK_Furnizori' table. You can move, or remove it, as needed.
this.spLK_FurnizoriTableAdapter.Fill(this.dsProduse.spLK_Furnizori);