Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using MySql.Data.MySqlClient;
- namespace e_money
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- public static string Username = "";
- public static string Password = "";
- private void button1_Click(object sender, EventArgs e)
- {
- DataTable table = new DataTable();
- Form2 Menu = new Form2();
- Username = textBox1.Text;
- Password = textBox2.Text;
- MySqlConnection con = new MySqlConnection("server=localhost;user id=root;database=e-money");
- MySqlDataAdapter adapter;
- con.Open();
- adapter = new MySqlDataAdapter("SELECT * FROM users WHERE username = '" + textBox1.Text + "' AND password = '" + textBox2.Text + "'", con);
- adapter.Fill(table);
- if (table.Rows.Count <= 0)
- {
- MessageBox.Show("Username atau Password salah", "Error", MessageBoxButtons.OK);
- }
- else
- {
- kirim_user.Username = textBox1.Text;
- kirim_user.Password = textBox2.Text;
- this.Hide();
- Menu.Show();
- }
- con.Close();
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement