public static void FillListWithId(ref myList lstBranch, string strTable, string strCol) { ConnectionToDB conn = new ConnectionToDB(); DataTable MyDataTable; //myList lstBranch = new myList(); MyDataTable = conn.GetDataTable("Select SWID," + strCol + " From " + strTable + " order by " + strCol + ""); if (MyDataTable != null) { lstBranch.DataSource = MyDataTable; lstBranch.ValueMember = "SWID"; lstBranch.DisplayMember = strCol; lstBranch.SelectedIndex = -1; } }
public static void FillList(ref myList lstRequired, string strTable, string strCol) { ConnectionToDB conn = new ConnectionToDB(); DataTable MyDataTable; //myList lstBranch = new myList(); MyDataTable = conn.GetDataTable("Select distinct " + strCol + " From " + strTable + " order by 1"); if (MyDataTable != null) { lstRequired.DataSource = MyDataTable; lstRequired.DisplayMember = strCol; lstRequired.SelectedIndex = -1; } }