private void btn_SelItemType_Click(object sender, EventArgs e) { DataSet set = null; string sErr = ""; string sSql = ""; string sFldsDate = ""; Button button = (Button)sender; sSql = "select cTypeId,cTypeName from TPC_MaterialType where ctypemode=0"; sFldsDate = ""; Cursor.Current = Cursors.WaitCursor; set = PubDBCommFuns.GetDataBySql(base.AppInformation.SvrSocket, sSql, sFldsDate, out sErr); Cursor.Current = Cursors.Default; if ((sErr.Trim() != "") && (sErr.Trim() != "0")) { MessageBox.Show(sErr); } else { frmSelItemList list = new frmSelItemList(); DataTable table = set.Tables["data"]; list.TableItem = table; list.TitleText = "物料类别选择"; list.FldDesc = "cTypeName"; list.FldKey = "cTypeId"; list.ShowDialog(); if (list.IsSelected) { this.txt_ItemType.Text = list.SelectItemList; this.txt_ItemType.Tag = list.SelectKeyList; } list.Dispose(); set.Clear(); } }
private void btn_SelItemType_Click(object sender, EventArgs e) { DataSet dsX = null; string sErr = ""; string sSql = ""; string sDateFld = ""; Button btnX = (Button)sender; sSql = "select cTypeId,cTypeName from TPC_MaterialType where ctypemode=0"; sDateFld = ""; Cursor.Current = Cursors.WaitCursor; dsX = PubDBCommFuns.GetDataBySql(AppInformation.SvrSocket, sSql, sDateFld, out sErr); Cursor.Current = Cursors.Default; if (sErr.Trim() != "" && sErr.Trim() != "0") { MessageBox.Show(sErr); return; } frmSelItemList frmX = new frmSelItemList(); //frmX.FldDesc = "cTypeName"; //frmX.FldKey = "cTypeId"; DataTable tbX = dsX.Tables["data"]; frmX.TableItem = tbX; frmX.TitleText = "物料类别选择"; frmX.FldDesc = "cTypeName"; frmX.FldKey = "cTypeId"; frmX.ShowDialog(); if (frmX.IsSelected) { txt_ItemType.Text = frmX.SelectItemList; txt_ItemType.Tag = frmX.SelectKeyList; } frmX.Dispose(); dsX.Clear(); }