private void Disp()
    {
        DG.DataSource = null;
        DG.DataBind();
        SqlConnection Cn = new SqlConnection(Ws.Con);

        Cn.Open();
        SqlCommand    Cmd = default(SqlCommand);
        SqlDataReader dr  = default(SqlDataReader);
        DataTable     dt  = new DataTable();
        DataRow       row = null;

        dt.Columns.Add("a");
        dt.Columns.Add("b");
        dt.Columns.Add("c");
        dt.Columns.Add("d");

        S   = "Select AlID,Subj,Alert,DT From Alert Where Active=1 And StaffMail=@M1";
        Cmd = new SqlCommand(S, Cn);
        Cmd.Parameters.Add(new SqlParameter("@M1", LblDisp.Text));
        dr = Cmd.ExecuteReader();
        while (dr.Read())
        {
            row    = dt.NewRow();
            row[0] = dr["AlID"].ToString();
            row[1] = dr["Subj"].ToString();
            row[2] = dr["Alert"].ToString();
            row[3] = dr["DT"].ToString();
            dt.Rows.Add(row);
        }
        dr.Close();
        Cmd.Dispose();

        DG.DataSource = dt;
        DG.DataBind();

        int Flg = 0;
        int i   = 0;

        String Msg = "";

        for (i = 0; i <= dt.Rows.Count - 1; i++)
        {
            Msg = dt.Rows[i][2].ToString();
            if (Msg.Length >= 50)
            {
                Msg = Msg.Substring(0, 49).ToString() + "...";
            }

            DG.Rows[i].Cells[0].Text = dt.Rows[i][0].ToString();
            DG.Rows[i].Cells[1].Text = dt.Rows[i][1].ToString();
            DG.Rows[i].Cells[2].Text = Msg;
            DG.Rows[i].Cells[3].Text = dt.Rows[i][3].ToString();
        }

        DG.Columns[0].Visible = false;
        Cn.Close();
    }
Exemple #2
0
    private void Disp()
    {
        DG.DataSource = null;
        DG.DataBind();
        SqlConnection Cn = new SqlConnection(Ws.Con);

        Cn.Open();
        SqlCommand    Cmd = default(SqlCommand);
        SqlDataReader dr  = default(SqlDataReader);
        DataTable     dt  = new DataTable();
        DataRow       row = null;

        dt.Columns.Add("a");
        dt.Columns.Add("b");
        dt.Columns.Add("c");

        S   = "Select AID,Attr,(Select Count(*) From Post Where AttriD=a.AID) Cnt From Attribute a Order By 3 DESC";
        Cmd = new SqlCommand(S, Cn);
        dr  = Cmd.ExecuteReader();
        while (dr.Read())
        {
            row    = dt.NewRow();
            row[0] = dr["AID"].ToString();
            row[1] = dr["Attr"].ToString();
            row[2] = dr["Cnt"].ToString();
            dt.Rows.Add(row);
        }
        dr.Close();
        Cmd.Dispose();

        DG.DataSource = dt;
        DG.DataBind();

        int Flg = 0;
        int i   = 0;

        for (i = 0; i <= dt.Rows.Count - 1; i++)
        {
            DG.Rows[i].Cells[0].Text = dt.Rows[i][0].ToString();
            DG.Rows[i].Cells[1].Text = dt.Rows[i][1].ToString();
            DG.Rows[i].Cells[2].Text = dt.Rows[i][2].ToString();
            if (Convert.ToInt16(Convert.ToString(dt.Rows[i][2].ToString())) <= 0)
            {
                DG.Rows[i].Cells[2].BackColor = System.Drawing.Color.LightPink;
                DG.Rows[i].Cells[2].Text      = "0";
            }
            else if (Convert.ToInt16(Convert.ToString(dt.Rows[i][2].ToString())) >= 1)
            {
                DG.Rows[i].Cells[2].BackColor = System.Drawing.Color.LightGreen;
            }
        }

        DG.Columns[0].Visible = false;
        Cn.Close();
    }
Exemple #3
0
    private void Disp()
    {
        DG.DataSource = null;
        DG.DataBind();
        SqlConnection Cn = new SqlConnection(Ws.Con);

        Cn.Open();
        SqlCommand    Cmd = default(SqlCommand);
        SqlDataReader dr  = default(SqlDataReader);
        DataTable     dt  = new DataTable();
        DataRow       row = null;

        dt.Columns.Add("a");
        dt.Columns.Add("b");
        dt.Columns.Add("c");
        dt.Columns.Add("d");

        S   = "Select * From Register";
        Cmd = new SqlCommand(S, Cn);
        dr  = Cmd.ExecuteReader();
        while (dr.Read())
        {
            row    = dt.NewRow();
            row[0] = dr["EmpID"].ToString();
            row[1] = dr["Name"].ToString();
            row[2] = dr["Mail"].ToString();
            row[3] = dr["Active"].ToString();
            dt.Rows.Add(row);
        }
        dr.Close();
        Cmd.Dispose();

        DG.DataSource = dt;
        DG.DataBind();

        int Flg = 0;
        int i   = 0;

        for (i = 0; i <= dt.Rows.Count - 1; i++)
        {
            DG.Rows[i].Cells[0].Text = dt.Rows[i][0].ToString();
            DG.Rows[i].Cells[1].Text = dt.Rows[i][1].ToString();
            DG.Rows[i].Cells[2].Text = dt.Rows[i][2].ToString();
            if (Convert.ToInt16(Convert.ToString(dt.Rows[i][3].ToString())) == 1)
            {
                DG.Rows[i].BackColor = System.Drawing.Color.LightGreen;
            }
            else if (Convert.ToInt16(Convert.ToString(dt.Rows[i][3].ToString())) == 0)
            {
                DG.Rows[i].BackColor = System.Drawing.Color.LightPink;
            }
        }
        Cn.Close();
    }
Exemple #4
0
    //protected System.Web.UI.WebControls.DataGrid DG;

    protected void Page_Load(object sender, EventArgs e)
    {   //Response.Write("hola");
        conn    = new SqlConnection(ConfigurationManager.ConnectionStrings["ustti_db_migration::connectionstring::target"].ConnectionString);
        ds      = new DataSet("schema comparison test");
        comm    = new SqlCommand(GetSqlString(), conn);
        adapter = new SqlDataAdapter(comm);
        adapter.Fill(ds);

        Console.Write(ds.GetXml());

        //DG = new DataGrid();
        DG.DataSource = ds;
        DG.DataBind();

        Cleanup();
    }
Exemple #5
0
    private void Disp()
    {
        DG.DataSource = null;
        DG.DataBind();
        SqlConnection Cn = new SqlConnection(Ws.Con);

        Cn.Open();
        SqlCommand    Cmd = default(SqlCommand);
        SqlDataReader dr  = default(SqlDataReader);
        DataTable     dt  = new DataTable();
        DataRow       row = null;

        dt.Columns.Add("a");
        dt.Columns.Add("b");
        dt.Columns.Add("c");

        S   = "Select * From Post Where Active=1";
        Cmd = new SqlCommand(S, Cn);
        dr  = Cmd.ExecuteReader();
        while (dr.Read())
        {
            row    = dt.NewRow();
            row[0] = dr["PID"].ToString();
            row[1] = dr["PostedDT"].ToString();
            row[2] = dr["Post"].ToString();
            dt.Rows.Add(row);
        }
        dr.Close();
        Cmd.Dispose();

        DG.DataSource = dt;
        DG.DataBind();

        int Flg = 0;
        int i   = 0;

        for (i = 0; i <= dt.Rows.Count - 1; i++)
        {
            DG.Rows[i].Cells[0].Text = dt.Rows[i][0].ToString();
            DG.Rows[i].Cells[1].Text = dt.Rows[i][1].ToString();
            DG.Rows[i].Cells[2].Text = dt.Rows[i][2].ToString();
        }
        Cn.Close();
        DG.Columns[0].Visible = false;
    }