Advertisement
Guest User

Untitled

a guest
Mar 30th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. String^ duomenys = "Server=127.0.0.1;Uid=root;Pwd=;Database=sql7285942";
  2.             MySqlConnection^ jungtis = gcnew MySqlConnection(duomenys);
  3.             MySqlCommand^ funkcija = gcnew MySqlCommand("select * from vartotojai where user='" + this->textBox1->Text + "' and pass='" + this->textBox2->Text + "';", jungtis);
  4.             MySqlDataReader^ skaitymas;
  5.  
  6.             try
  7.             {
  8.                 int kiekis = 0;
  9.                 jungtis->Open();
  10.                 skaitymas = funkcija->ExecuteReader();
  11.  
  12.                 while (skaitymas->Read())
  13.                     kiekis++;
  14.  
  15.                 if (ArYraVartotojas(kiekis))
  16.                 {
  17.                     //this->Hide();
  18.                     Nuomininkai^ nuomininkaiForma = gcnew Nuomininkai();
  19.                     nuomininkaiForma->ShowDialog();
  20.                 }
  21.  
  22.                 else
  23.                     MessageBox::Show("Vartotojas nerastas\nKreipkites į sistemos administratorių");
  24.             }
  25.  
  26.             catch (Exception^ exceptionError)
  27.             {
  28.                 MessageBox::Show(exceptionError->Message);
  29.             }
  30.         }
  31.         bool ArYraVartotojas(int a)
  32.         {
  33.             if (a == 1)
  34.                 return true;
  35.             else
  36.                 return false;
  37.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement