public bool editsug(SugestoesProp sugedit) { string mainconn = ConfigurationManager.ConnectionStrings["MysqlConnection"].ConnectionString; MySqlConnection mysqlconn = new MySqlConnection(mainconn); string sqlquery = "update sugestao set sug='" + sugedit.sug + "' where id_sug='" + sugedit.id_sug + "'"; MySqlCommand sqlcomm = new MySqlCommand(sqlquery, mysqlconn); mysqlconn.Open(); int i = sqlcomm.ExecuteNonQuery(); mysqlconn.Close(); if (i >= 1) { return(true); } else { return(false); } }
public bool insertsug(SugestoesProp suginsert) { string mainconn = ConfigurationManager.ConnectionStrings["MysqlConnection"].ConnectionString; MySqlConnection mysqlconn = new MySqlConnection(mainconn); string sqlquery = "insert into sugestao (id_sug, id_crianca, id_inst, sug) values ('" + suginsert.id_sug + "', '" + suginsert.id_crianca + "','" + suginsert.id_inst + "', '" + suginsert.sug + "')"; MySqlCommand sqlcomm = new MySqlCommand(sqlquery, mysqlconn); mysqlconn.Open(); int i = sqlcomm.ExecuteNonQuery(); mysqlconn.Close(); if (i >= 1) { return(true); } else { return(false); } }