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 WindowsFormsApplication3
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- string myConnection = "datasource=s59.hekko.pl;port=3306;username=truex2_kuba;password=xxxx";
- SqlConnection myConn = new MySqlConnection(myConnection);
- MySqlCommand SelectCommand = new MySqlCommand("select * from databaase.users where uid='" + this.uid.Text + "' and pwd='" + this.pwd.Text + "' ;", myConn);
- MySqlDataReader myReader;
- myConnection.Open();
- myReader = SelectCommand.ExecuteReader();
- int count = 0;
- while (myReader())
- {
- count = count + 1;
- }
- if (count == 1)
- {
- MessageBox.Show("Nazwa uzytkownika i haslo sa poprawne");
- }
- else if (count > 1)
- {
- MessageBox.Show("Wpisano zle dane uzytkownika");
- }
- else
- MessageBox.Show("Wpisano zle dane uzytkownika");
- MyConn.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement