private void button1_Click(object sender, EventArgs e) { if (mConnection != null) { if (mConnection.cnMySQL.State != ConnectionState.Closed) { mConnection.cnMySQL.Close(); } if (mConnection.cnMySQL.State != ConnectionState.Open) { mConnection.cnMySQL.Open(); } mConnection.cmdMySQL = mConnection.cnMySQL.CreateCommand(); float prezz = /*Convert.ToSingle(npers.Value)*/ prezzo * days; mConnection.cmdMySQL.CommandText = "INSERT INTO conti (id,nome,prezzo,iva,quantità ,data,camera) VALUES('" + npren + "','Tassa Soggiorno','" + prezz.ToString() + "',0," + npers.Value + ",'" + DateTime.Now.ToShortDateString() + "','" + currentcamera + "')"; mConnection.cmdMySQL.ExecuteNonQuery(); mConnection.cnMySQL.Close(); if (!frompan) { bel3.checkinnew(); } else { bel3.checkinpanoramica(); } this.Close(); } }