我正在尝试检查我已连接到我的程序的数据库以获取用户名和密码,我已经进行了查询,但我将如何根据表检查它。
private void button1_Click(object sender, EventArgs e)
{
Menu m1 = new Menu();
string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=UserAccounts.accdb; Persist Security Info=False;";
OleDbCommand cmd = new OleDbCommand("Select * from UserAccounts where Username = " +userBox.Text + " and Password] = " + Password.Text + "");
using (OleDbConnection conn = new OleDbConnection(connectionString))
{
try
{
conn.Open();
this.Hide();
m1.Show();
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
}
}