public void disp_DescTable() { //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 Description IN ( SELECT Description" + * " FROM TRIGGERS);"; */ string query = " SELECT processing_date AS 'Processing Date', " + " CONCAT('$', amount) AS Amount, " + " CONCAT('$', balance) AS Balance, " + " Action, " + " Description, " + " State FROM CustomerData " + " WHERE Description 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 DescriptionTable.DataSource = dt; DescriptionTable.DataBind(); }
private void btn_Add_Click(object sender, EventArgs e) { var descTable = new DescriptionTable(); var record = descTable.NewRecord(); record.Category = "Dinner"; record.Name = "ABC 1"; descTable.Rows.Add(record); record = descTable.NewRecord(); record.Category = "Dinner2"; record.Name = "ABC 2"; descTable.Rows.Add(record); EditDB.AddRecords(descTable); //EditDB.UpdateRecords(descTable); }