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 MySQL
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- MySqlConnection connect = new MySqlConnection("Server=mysql.hostinger.ro;Database=u119248796_mach;Uid=u119248796_mach;Pwd=vezisanu123;");
- int i;
- i = 0;
- connect.Open();
- MySqlCommand cmd = connect.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "SELECT * FROM `users` WHERE username='" + textBox1.Text + "' and password='" + textBox2.Text + "'";
- cmd.ExecuteNonQuery();
- DataTable dt = new DataTable();
- MySqlDataAdapter da = new MySqlDataAdapter(cmd);
- da.Fill(dt);
- i = Convert.ToInt32(dt.Rows.Count.ToString());
- if (i == 0)
- {
- MessageBox.Show("gresit");
- }
- else
- {
- MessageBox.Show("corect");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement