Exemple #1
0
        public void disp_StateTable()
        {
            //Creates a command for the SQL query
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;

            string query = " SELECT processing_date AS 'Processing Date' ," +
                           " CONCAT('$', amount) AS Amount ," +
                           " CONCAT('$', balance) AS Balance ," +
                           " Action ," +
                           " Description ," +
                           " State FROM CustomerData" +
                           " WHERE STATE IN ( SELECT Description" +
                           "                    FROM TRIGGERS ); ";

            cmd.CommandText = query;

            //Executes the SQL query
            cmd.ExecuteNonQuery();

            //Data Table Read from sql server
            DataTable dt = new DataTable();

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            //Fills the SQL Data by the Data Table
            da.Fill(dt);

            //Gets the Data from the data table and places it into the HTML
            StateTable.DataSource = dt;
            StateTable.DataBind();
        }