private void Sut_Save_Click(object sender, EventArgs e) { string strsql = "select * from BasicData"; string DA = MyMC.AddOwner(Ownerinfo) + "' "; DA += MyMC.AddHeaderData(HeaderDataInfo) + "' "; DA += MyMC.AddNeckData(NeckDataInfo) + "' "; DA += MyMC.AddShoulderData(ShoulderDataInfo) + "' "; DA += MyMC.AddChestData(ChestDataInfo) + "' "; DA += MyMC.AddBellyWaistHipData(BellyWaistHipDataInfo) + "' "; DA += MyMC.AddTrunkIntegralData(TrunkIntegralDataInfo) + "' "; DA += MyMC.AddUpperLimbsData(UpperLimbsDataInfo) + "' "; DA += MyMC.AddLowerLimbsData(LowerLimbsDataInfo) + "' "; DA += MyMC.AddFootData(FootDataInfo) + "' "; //将查询条件添加到SQL语句的尾部 strsql = strsql + " where 1=1 "; //if (DA != "") //{ strsql = strsql + DA; // } //按照指定的条件进行添加 MyDS_Grid = MyDataClass.getDataSet(strsql, "BasicData"); MyDataClass.RunProc(BaseClass.BaseInfo.ADDs); this.Close(); // dgvQueryList.DataSource = MyDS_Grid.Tables[0].DefaultView; // BaseClass.BaseInfo.ADDs = ""; //清空MyModule公共类中的ADDs变量 //用MyModule公共类中的Part_SaveClass()方法组合添加或修改的SQL语句 // MyMC.Part_SaveClass(All_Field, S_0.Text.Trim(), "", tabControl1.TabPages[0].Controls, "S_", "tb_Stuffbusic", 30, hold_n); //如果ADDs变量不为空,则通过MyMeans公共类中的getsqlcom()方法执行添加、修改操作 //if (BaseClass.BaseInfo.ADDs != "") // MyDataClass.getsqlcom(ModuleClass.MyModule.ADDs); }
private void button1_Click(object sender, EventArgs e) { BaseClass.BaseInfo.FindValue = ""; //清空存储查询语句的变量 string Find_SQL = Sut_SQL; //存储显示数据表中所有信息的SQL语句 // baseinfo.Find_Grids(groupBox1.Controls, "Find", ARsign); //将指定控件集下的控件组合成查询条件 string strwhere = ""; string strsql = "select * from BasicData"; if (cmbID.Text != "") { strwhere += " and id='" + cmbID.Text + "' "; } if (cmbSex.Text != "") { strwhere += " and sex='" + cmbSex.Text + "' "; } if (cmbIDCard.Text != "") { strwhere = strwhere + " and idcard='" + cmbIDCard.Text + "' "; } if (txt1_Bust.Text != "" && txt2_Bust.Text != "") { strwhere = strwhere + " and bust>='" + txt1_Bust.Text + "' and bust<='" + txt2_Bust.Text + "' "; } if (txt1_Age.Text != "" && txt2_Age.Text != "") { strwhere = strwhere + " and age>='" + txt1_Age.Text + "' and age<='" + txt2_Age.Text + "' "; } if (txt1_Waist.Text != "" && txt2_Waist.Text != "") { strwhere = strwhere + " and Waist>='" + txt1_Waist.Text + "' and Waist<='" + txt2_Waist.Text + "' "; } if (txt1_BodyHigh.Text != "" && txt2_BodyHigh.Text != "") { strwhere = strwhere + " and BodyHight>='" + txt1_BodyHigh.Text + "' and BodyHigh<='" + txt2_BodyHigh.Text + "' "; } // if (txt1_ButtockGirth.Text != "" && txt2_ButtockGirth.Text != "") { strwhere = strwhere + " and ButtockGirth>='" + txt1_ButtockGirth.Text + "' and ButtockGirth<='" + txt2_ButtockGirth.Text + "' "; } //将查询条件添加到SQL语句的尾部 strsql = strsql + " where 1=1 "; if (strwhere != "") { strsql = strsql + strwhere; } //按照指定的条件进行查询 MyDS_Grid = BasicDatainfo.getDataSet(strsql, "BasicData"); dgvQueryList.DataSource = MyDS_Grid.Tables[0].DefaultView; //在dataGridView1控件是显示查询的结果 // dgvQueryList.DataSource = baseinfo.GetAllBasicData("BasicData").Tables[0].DefaultView; checkBox1.Checked = false; this.SetdgvQueryListHeadText(); }