c# - how to join tow combobox data -
i have 2 combo box 1 , data load 2 different table first combobox code is
> oledbcommand cmd = new oledbcommand("select empno,ename emp", con); oledbdatareader dr = cmd.executereader(); while (dr.read()) { combobox1.items.add(dr[1].tostring()); }
result:
king blake clark
and second combobox code is
> oledbcommand cmd1 = new oledbcommand("select unitid,unitname > tableunit", con); > oledbdatareader dr1 = cmd1.executereader(); > while (dr1.read()) > { > combobox2.items.add(dr1[1].tostring()); > }
result:
accounting research sales operations
how can have load data join both result (combobox1+combobox2) combobox3 such
king accounting blake research
you can merge 2 combobox content in third combobox in following way :
for (int = 0; < (combobox1.items.count < combobox2.items.count ? combobox1.items.count : combobox2.items.count); i++) { combobox3.items.add($"{combobox1.items[i]} {combobox2.items[i]}"); }
Comments
Post a Comment