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 program1
- {
- public partial class Form2 : Form
- {
- public Form2()
- {
- InitializeComponent();
- }
- string connectionString = "datasource=remotemysql.com;port=3306;username=Pcmvh65uNG;password=8D2mDip530;database=Pcmvh65uNG;";
- string username;
- string password;
- string query;
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- Convert.ToString(textBox1.Text);
- username = textBox1.Text;
- }
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- Convert.ToString(textBox2.Text);
- password = textBox2.Text;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- query = "SELECT * FROM `users` WHERE (`username` = '" + username + "' AND `password` = '" + password + "')";
- MySqlConnection databaseConnection = new MySqlConnection(connectionString);
- MySqlCommand commandDatabase = new MySqlCommand(query, databaseConnection);
- try
- {
- databaseConnection.Open();
- MySqlDataReader myreader = commandDatabase.ExecuteReader();
- if (myreader.HasRows)
- {
- MessageBox.Show("bun");
- }
- else
- {
- MessageBox.Show("rau");
- }
- }
- catch (MySqlException numar)
- {
- if (numar.Number == 1042)
- {
- MessageBox.Show("Server is down");
- }
- }
- }
- private void label1_Click(object sender, EventArgs e)
- {
- Form1 fm1 = new Form1();
- Form2 fm2 = new Form2();
- fm1.Show();
- fm2.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement