这是我用于c#mysql登录系统的代码
try
{
MySqlConnection connection = new MySqlConnection("Server=localhost; database=member; UID=root; Pwd=");
MySqlCommand cmd = new MySqlCommand("SELECT * FROM member.member WHERE username='" + this.metroTextBox1.Text + "' AND password='" + this.metroTextBox2.Text + "' ;", connection);
MySqlDataReader myReader;
connection.Open();
myReader = cmd.ExecuteReader();
int count = 0;
while (myReader.Read())
{
count = count + 1;
}
if (count == 1)
{
Form2 frm = new Form2();
frm.username = metroTextBox1.Text;
frm.Show();
this.Visible = false;
}
else
{
MetroMessageBox.Show(this, "Incorrect login credentials. Failed to login!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
这是我的数据库 http://i.imgur.com/K831atR.png
基本上我想在expirationdate通过时阻止登录。但我不知道该怎么做。
答案 0 :(得分:1)
试试这个:
0x1f