Esempio n. 1
0
        public bool editInst(Instituicaomod instEdit)
        {
            string          mainconn  = ConfigurationManager.ConnectionStrings["MysqlConnection"].ConnectionString;
            MySqlConnection mysqlconn = new MySqlConnection(mainconn);
            string          sqlquery  = "update instituicao set nome='" + instEdit.nome + "'where id_inst='" + instEdit.id_inst + "'";
            MySqlCommand    sqlcomm   = new MySqlCommand(sqlquery, mysqlconn);

            mysqlconn.Open();
            int i = sqlcomm.ExecuteNonQuery();

            mysqlconn.Close();
            if (i >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool insertInst(Instituicaomod instInsert)
        {
            string          mainconn  = ConfigurationManager.ConnectionStrings["MysqlConnection"].ConnectionString;
            MySqlConnection mysqlconn = new MySqlConnection(mainconn);
            string          sqlquery  = "insert into instituicao (nome, pass) values ('" + instInsert.nome + "','" + instInsert.pass + "') ";
            MySqlCommand    sqlcomm   = new MySqlCommand(sqlquery, mysqlconn);

            mysqlconn.Open();
            int i = sqlcomm.ExecuteNonQuery();

            mysqlconn.Close();
            if (i >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }