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;
- using System.Data.SqlClient;
- using System.Data;
- namespace login
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- MySqlConnection con = new MySqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Beni\source\repos\HR\DB.mdf;Integrated Security=True;Connect Timeout=30;");
- MySqlDataAdapter sda = new MySqlDataAdapter("Select Count(*) From Login where Username='"+textBox1.Text+"' and Password='"+textBox2.Text+"'",con);
- DataTable dt = new DataTable();
- sda.Fill(dt);
- if(dt.Rows[0][0].ToString() == "1")
- {
- this.Hide();
- Form2 ss = new Form2();
- ss.Show();
- }
- else
- {
- MessageBox.Show("Hibas felhasznalonev, vagy jelszo.");
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }
Add Comment
Please, Sign In to add comment