public string ConnectiinString = @"Data Source=HP;Initial Catalog=Учебное заведение;Integrated Security=True";
public SqlConnection connect;
public Form2()
{
InitializeComponent();
}
private void bunifuFlatButton1_Click(object sender, EventArgs e)
{
}
private void bunifuThinButton22_Click(object sender, EventArgs e)
{
Close();
}
private void bunifuThinButton21_Click(object sender, EventArgs e)
{
connect = new SqlConnection(ConnectiinString);
connect.Open();
if (bunifuMetroTextbox1.Text == "Admin")
{
DataTable table = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter();
String login = bunifuMetroTextbox1.Text;
String pass = bunifuMetroTextbox2.Text;
string Sql = @"Select User, Password From Пользователи Where User = @ul And Password = @up";
SqlCommand command = new SqlCommand(Sql, connect);
command.Parameters.Add("@ul", SqlDbType.VarChar).Value = bunifuMetroTextbox1.Text;
command.Parameters.Add("@up", SqlDbType.VarChar).Value = bunifuMetroTextbox2.Text;
adapter.SelectCommand = command;
adapter.Fill(table);
command.ExecuteNonQuery();
int a = table.Rows.Count;
if (table.Rows.Count > 0)
{
MessageBox.Show("No");
}
else
{
MessageBox.Show("Yes" + a);
}
}
else
{
MessageBox.Show("панятна");
}
}