Initiate Mage
- Joined
- Jan 3, 2017
- Messages
- 70
- Reaction score
- 12
Code:
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();
}
}
BTW Its not complete, you need to modif this code cause every user register can be duplicate data, like : same username and same password but with diff id.
Have a good work ^_^
use this for connection : https://github.com/npgsql/npgsql
Or maybe you wait someone to release a fix launcher? HAHAHA. bllsht~
Last edited: