MS Access への OleDb 接続に問題があります。この行はエラーをスローしています:
command1.ExecuteNonQuery();
次の部分は私のコードです:
if (textBox.Text.Length != 6) return;
{
cmd.CommandText = ("SELECT last_name +', '+ first_name from name where id =@Name");
cmd.Parameters.Add(new SqlParameter("Name", textBox.Text.Replace(@"L", "")));
cmd.CommandType = CommandType.Text;
cmd.Connection = DBConnection;
returnValue = cmd.ExecuteScalar() + "\t " + textBox.Text.Replace(@"L", "");
DBConnection.Close();
OleDbConnection connection1 = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\Registration.accdb");
OleDbCommand command1 = new OleDbCommand();
command1.CommandText = "UPDATE Table SET ID=@ID, Name=@Name, TimeIn=@TimeInAM, TimeOut=@TimeOutAM";
command1.Parameters.AddWithValue("@ID", returnValue);
connection1.Open();
command1.ExecuteNonQuery();
connection1.Close();
Staff_Register(returnValue, e);
}