private void initRLocation() { //初始化工位下拉列表 string sql = "select distinct location_code from code_location where pline_code in (select pline_id from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "') ORDER BY LOCATION_CODE"; SqlRLocation.SelectCommand = sql; SqlRLocation.DataBind(); }
protected void txtRLoction_Callback(object sender, CallbackEventArgsBase e) { string pline_id = dc.GetValue("select rmes_id from code_product_line where pline_code='" + e.Parameter + "'"); string sql = "select distinct location_code from code_location where pline_code ='" + pline_id + "' ORDER BY LOCATION_CODE"; SqlRLocation.SelectCommand = sql; SqlRLocation.DataBind(); CombRLocation.DataBind();//两次绑定才行 }
private void initCode() { //初始化生产线下拉列表 string sql = "select distinct a.pline_code,b.pline_name,a.pline_id from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'"; SqlCode.SelectCommand = sql; SqlCode.DataBind(); DataTable dt = dc.GetTable(sql); string sql2 = ""; if (dt.Rows.Count > 0) { sql2 = "select distinct location_code from code_location where pline_code ='" + dt.Rows[0][2].ToString() + "' ORDER BY LOCATION_CODE"; } else { sql2 = "select distinct location_code from code_location where pline_code in (select pline_id from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "') ORDER BY LOCATION_CODE"; } SqlRLocation.SelectCommand = sql2; SqlRLocation.DataBind(); }