1

Possible Duplicate:
WinForms combobox with multiple columns (C#)?

I this procedure ALTER proc [dbo].[VCNAE] as select cnae_id,cnae_descricao, cnae_classe from tbl_CNAE order by cnae_descricao

I use for populate this dataset

        SqlCommand llena4 = new SqlCommand("vcnae", abre);
        llena4.CommandType = CommandType.StoredProcedure;
        da2.SelectCommand = llena4;
        da2.Fill(carga1, "cnae");//4

Then i populate combobox

         BindingSource srd = new BindingSource();
         srd.DataSource = llenar.Tables["cnae"];
         CmbCnaePrin.DataSource = srd;
         CmbCnaePrin.DisplayMember = "cnae_descricao" ;
         CmbCnaePrin.ValueMember = "cnae_id";
         CmbCnaePrin.SelectedValue = 259;

I want to show in display member this :

cnae_descricao, cnae_classe

                     displaymember = "cnae_descricao"+"cnae_classe"; but this code not work how can  i solve this::????

Thanks

Community
  • 1
  • 1
alejandro carnero
  • 1,774
  • 7
  • 27
  • 43
  • I am assuming that you are using Win Forms. Do you what you want you have to concatenate the string at SQL level. Example: Select cnae_descricao + ' ' + cnae_classe As cnae_fulldesc From tb_data – A. Agius Oct 19 '12 at 15:04
  • Thanks I have solve this ALTER proc [dbo].[VCNAE] as select cnae_id, cnae_descricao + ' ' + cnae_classe as cnaetotal from tbl_cnae order by cnae_descricao – alejandro carnero Oct 19 '12 at 16:43

0 Answers0