Beispiel #1
0
    protected void GetPo_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        GetColor.Items.Clear();
        GetColor.Items.Add(new ListItem("-", ""));
        GetColor.AppendDataBoundItems = true;
        SqlConnection conn      = new SqlConnection(DbSpecFo.x);
        String        strQuery1 = @"select distinct sm.cStyleNo,om.cPoNum,sof.nFabColNo,sc.cColour,om.nfob,om.DXfty from Smt_OrdersMaster om join Smt_StyleMaster sm on om.nOStyleId=sm.nStyleID 
																	join Smt_OrdFabColor sof on om.nOStyleId=sof.nStyleID
																	join Smt_Colours sc on sof.nFabColNo=sc.nColNo where cStyleNo='"                                                                     + GetStyle.SelectedItem.Text + "' and cPoNum='" + GetPo.SelectedItem.Text + "' ";
        SqlCommand    cmd1      = new SqlCommand();

        cmd1.CommandType = CommandType.Text;
        cmd1.CommandText = strQuery1;
        cmd1.Connection  = conn;
        try
        {
            conn.Open();

            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd1);
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                txtFob.Text = dt.Rows[0]["nfob"].ToString();
            }

            GetColor.DataSource     = dt;
            GetColor.DataTextField  = "cColour";
            GetColor.DataValueField = "nFabColNo";
            GetColor.DataBind();
            if (GetColor.Items.Count > 1)
            {
                GetColor.Enabled = true;
            }
            else
            {
                GetColor.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }
    }