public void modelBind(ComboBox cmb, TransportLogic.TranType type, string strWhere) { cmb.DataSource = transportDB.modelBind(type, strWhere).Tables[0]; cmb.DisplayMember = "model"; cmb.ValueMember = "id"; cmb.SelectedIndex = -1; }
public DataSet modelBind(TransportLogic.TranType type, string strWhere) { string sqlStr = null; switch (type) { case TransportLogic.TranType.material: sqlStr = "select mm.id,mm.model from material m,materialModel mm where m.mmid=mm.id and m.mnid=" + strWhere; break; case TransportLogic.TranType.product: sqlStr = "select pm.id,pm.model from product p,productModel pm where p.pmid=pm.id and p.pnid=" + strWhere; break; } return(TransportDB.Query(sqlStr)); }
/// <summary> /// 类构造函数 /// </summary> /// <param name="cmb1">类别</param> /// <param name="cmb2">名称</param> /// <param name="cmb3">规格</param> /// <param name="tranType"></param> public DoCombox(ComboBox cmb1, ComboBox cmb2, ComboBox cmb3, TransportLogic.TranType tranType) { this.Cmb1 = cmb1; this.Cmb2 = cmb2; this.Cmb3 = cmb3; Cmb1.SelectionChangeCommitted += cmb_1_SelectionChangeCommitted; Cmb2.SelectionChangeCommitted += cmb_2_SelectionChangeCommitted; this.TranType = tranType; cmb1.DataSource = null; cmb2.DataSource = null; cmb3.DataSource = null; kindBind(this.Cmb1, tranType, null); }
public DataSet kindBind(TransportLogic.TranType type, string strWhere) { string sqlStr = null; switch (type) { case TransportLogic.TranType.material: sqlStr = "select id,sort from materialKind"; break; case TransportLogic.TranType.product: sqlStr = "select id,sort from productKind"; break; } if (!string.IsNullOrEmpty(strWhere)) { sqlStr += " where id= " + strWhere; } return(TransportDB.Query(sqlStr)); }
public DataSet nameBind(TransportLogic.TranType type, string strWhere) { string sqlStr = null; switch (type) { case TransportLogic.TranType.material: sqlStr = "select id,name from materialName"; if (!string.IsNullOrEmpty(strWhere)) { sqlStr += " where mkid= " + strWhere; } break; case TransportLogic.TranType.product: sqlStr = "select id,name from productName"; if (!string.IsNullOrEmpty(strWhere)) { sqlStr += " where pkid= " + strWhere; } break; } return(TransportDB.Query(sqlStr)); }