我正在尝试将我的ASP.NET在线注册表单连接到MS Access后端数据库。我正在使用的连接代码是
string myQuery = "INSERT INTO Parent([Username], [FirstName], [Surname], [Email], [Mobile], [Postcode], [Password]) values('" + Usernametb.Text + "','" + Firsttnametb.Text + "','" + Surnametb.Text + "','" + Emailtb.Text + "','" + Mobiletb.Text + "','" + Postcodetb.Text + "','" + Passwordtb.Text + "')";
string connString = @"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:\Users\Z\Desktop\database\WorkDatabase.accdb";
try
{
using (OleDbConnection myConnection = new OleDbConnection(connString))
{
using (OleDbCommand myCommand = myConnection.CreateCommand())
{
myCommand.CommandText = myQuery;
myConnection.Open();
myCommand.ExecuteNonQuery();
SuccReglbl.Text = "successful registration";
}
}
}
catch (Exception ex)
{
SuccReglbl.Text = "Exception in DBHandler " + ex.Message;
}
点击“注册”按钮后,我一直收到错误消息。说“DBHandler溢出中的异常”