protected void RptTarefa_ItemCommand(object source, RepeaterCommandEventArgs e) { string sql; if (e.CommandName == "Apagar") { HiddenField hidID_Tarefa = (HiddenField)e.Item.FindControl("hidID_Tarefa"); sql = "DELETE FROM tarefas WHERE ID_Tarefas = " + hidID_Tarefa.Value; using (MySqlConnection con = new MySqlConnection(conect)) { using (MySqlCommand cmd = new MySqlCommand(sql, con)) { cmd.CommandType = CommandType.Text; using (MySqlDataAdapter sda = new MySqlDataAdapter(cmd)) { using (DataTable dt = new DataTable()) { { sda.Fill(dt); RptTarefa.DataSource = dt; RptTarefa.DataBind(); } } } } } PopularRomaneios(); } if (e.CommandName == "Editar") { Response.Redirect("Editar.aspx?page=tarefa&id_tarefa=" + Convert.ToString(e.CommandArgument)); } }
void PopularRomaneios(int?pageIndex) { int ID_User = Convert.ToInt32(Session["user"]); using (MySqlConnection con = new MySqlConnection(conect)) { using (MySqlCommand cmd = new MySqlCommand("SELECT *, (SELECT nome FROM importancia I INNER JOIN tarefas T ON I.ID_Status = T.importancia ) AS status FROM tarefas WHERE ID_User = " + ID_User, con)) { cmd.CommandType = CommandType.Text; using (MySqlDataAdapter sda = new MySqlDataAdapter(cmd)) { using (DataTable dt = new DataTable()) { { sda.Fill(dt); RptTarefa.DataSource = dt; RptTarefa.DataBind(); } } } } } }