private void button2_Click(object sender, EventArgs e)
{
if (bunifuMaterialTextbox1.Text == "" || bunifuMaterialTextbox2.Text == "" || bunifuMaterialTextbox4.Text == "")
MessageBox.Show("Harap lengkapi data", "Pemberitahuan", MessageBoxButtons.OK);
else if (bunifuMaterialTextbox2.Text != bunifuMaterialTextbox3.Text)
MessageBox.Show("Password tidak sama", "Pemberitahuan", MessageBoxButtons.OK);
else {
NpgsqlConnection conn = new NpgsqlConnection("Server=SERVER_IP;Port=5432;User Id=POSTGRES_USER;Password=PASSWORD;Database=DB_NAME"); conn.Open();
NpgsqlCommand cmd = new NpgsqlCommand("insert into contas (login,senha,email) values(:name, :pw, :email)", conn);
cmd.Parameters.Add(new NpgsqlParameter("name", bunifuMaterialTextbox1.Text));
cmd.Parameters.Add(new NpgsqlParameter("pw", bunifuMaterialTextbox2.Text));
cmd.Parameters.Add(new NpgsqlParameter("email", bunifuMaterialTextbox4.Text));
cmd.ExecuteNonQuery();
MessageBox.Show("Berhasil Mendaftar", "Pemberitahuan", MessageBoxButtons.OK);
Clear();
}
}