我收到错误
OleDbException 未处理 - 标准表达式中的数据类型不匹配
在 OleDbDataReader re = cmd.ExecuteReader() 线上有人能帮我吗?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.OleDb;
namespace posSystem
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=userName.accdb");
OleDbCommand cmd = new OleDbCommand("Select * From userAndPAss Where ID = '" + txtBoxUserName + "' and Password = '" + txtBoxPassword + "';", conn);
conn.Open();
OleDbDataReader re = cmd.ExecuteReader();
if(re.Read()
{
MessageBox.Show("Login Successfull");
}
else{
MessageBox.Show("Login NOT Successfull, Try again!");
}
}
}
}