Exemplo n.º 1
0
    private void BindOperationGrid()
    {
        lblGType.Text = Session["GType"].ToString();
        int           gType = int.Parse(Session["GTypeId"].ToString());
        SqlConnection conn  = new SqlConnection(DbConnect.x);
        DataTable     dt    = new DataTable();

        try
        {
            conn.Open();
            SqlCommand     cmd1 = new SqlCommand("select b.OperationName,a.SMV,a.MachineQty,a.ManQty  from tblGtypeProcess a join tblProcess b on a.Process = b.Id where GType = " + gType, conn);
            SqlDataAdapter da1  = new SqlDataAdapter(cmd1);
            da1.Fill(dt);
            //OperationGridView.DataMember = "tblOperation";
            OperationGridView.DataSource = dt;
            OperationGridView.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write("Error Occured: " + ex.ToString());
        }
        finally
        {
            conn.Close();
            //dt.Clear();
            //ds.Dispose();
        }
    }
Exemplo n.º 2
0
    private void BindOperationGrid()
    {
        SqlConnection conn = new SqlConnection(DbConnect.x);
        DataTable     dt   = new DataTable();

        try
        {
            SqlCommand cmd = new SqlCommand("GET_OPERATION_DATA", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter adp = new SqlDataAdapter(cmd);

            adp.Fill(dt);
            OperationGridView.DataSource = dt;
            OperationGridView.DataBind();

            //if (dt.Rows.Count > 0)
            //{
            //    OperationGridView.DataSource = null;
            //    OperationGridView.DataBind();

            //}
        }
        catch (Exception ex)
        {
            Response.Write("Error Occured: " + ex.ToString());
        }
        finally
        {
            //dt.Clear();
            //ds.Dispose();
        }
    }
Exemplo n.º 3
0
    protected void GetGType_SelectedIndexChanged(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(DbConnect.x);

        conn.Open();
        SqlCommand     cmd1 = new SqlCommand("select b.id, b.OperationName,a.SMV,a.MachineQty,a.ManQty  from tblGtypeProcess a join tblProcess b on a.Process = b.Id where GType = '" + GetGType.SelectedItem.Value + "'", conn);
        SqlDataAdapter da1  = new SqlDataAdapter(cmd1);
        DataSet        ds   = new DataSet();

        da1.Fill(ds);
        //OperationGridView.DataMember = "tblOperation";
        OperationGridView.DataSource = ds;
        OperationGridView.DataBind();
        conn.Close();
    }