C# oturum açma formum var yönetici burada "admin" kullanıcı adı ve "admin" olarak şifre ile giriş yapacaktır. İkinci ve sonraki girişler varsayılan yönetici kimlik bilgilerini kabul etmeyecek şekilde değiştirmek istiyorum.C# Kayıt formu önce admin ilk giriş
private void btnlogin_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection("Data Source=(local);Initial Catalog=login1;Integrated Security=True");
cn.Open();
SqlCommand cmd = new SqlCommand("select * from user2 where username = '"+textBox1.Text+"' and password = '"+textBox2.Text+"'", cn);
SqlDataReader dr;
dr = cmd.ExecuteReader();
int count = 0;
while (dr.Read())
{
count += 1;
}
if (count == 1)
{
MessageBox.Show("OK");
Form2 frm2 = new Form2();
frm2.Show();
}
else if (count > 0)
{
MessageBox.Show("Duplicate usernameand password");
}
else
{
MessageBox.Show("username and password is incorrect", "Please try again");
}
textBox1.Clear();
textBox2.Clear();
}
private void btnexit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
nasıl tarif revize davranışı uygulayabilirsiniz: Burada
benim şimdiki kodudur?
Yazdığınız bazı kodları yazın. – n1c9