Hi, I'm working with VS 2003 C# as a begginer. I have some code as follow
but can't figure out how to retireve the column "scode" if I gotten the "sid"
from my combo box selectedvalued. It's not pasting very well. I would
appreciate any help thought.
Thanks,
Alpha
cmdLocal.CommandText = "select sID,scode,sname from tblsource";
cmdLocal.CommandType = CommandType.Text;
saLocal.Fill(dsLocal,"source");
//We need to add a blank entry
BindingContext[dsLocal.Tables["source"]].AddNew();
BindingContext[dsLocal.Tables["source"]].Position =
BindingContext[dsLocal.Tables["source"]].Count -1;
drv = (DataRowView) BindingContext[dsLocal.Tables["source"]].Current;
drv.Row["sid"] = -1;
drv.Row["scode"] = "";
drv.Row["sname"] = "";
dsLocal.Tables["source"].AcceptChanges();
DataColumn sc = new DataColumn("ScodeName",Type.GetType("System.String "));
sc.Expression = "iif(len(scode) > 0,scode + ': ' + sname,sname)";
dsLocal.Tables["source"].Columns.Add(sc);
dvSource = new
DataView(dsLocal.Tables["source"],"","sname",DataViewRowState.CurrentRows);
this.cboPaySource.DataSource = dvSource;
cboPaySource.ValueMember = "sID";
cboPaySource.DisplayMember = "ScodeName";