C# WPF,在将记录插入主表时没有问题,但无法更新辅助表记录

C# WPF,在将记录插入主表时没有问题,但无法更新辅助表记录,c#,wpf,visual-studio,oledbconnection,C#,Wpf,Visual Studio,Oledbconnection,我有两个访问表: try { OleDbConnection connection = new OleDbConnection(); connection.ConnectionString = @"myconnectionstring_blah_blah"; OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText =

我有两个访问表:

try
{
    OleDbConnection connection = new OleDbConnection();
    connection.ConnectionString = @"myconnectionstring_blah_blah";


    OleDbCommand command = new OleDbCommand();
    command.Connection = connection;
    command.CommandText = "INSERT INTO StaffOrders (StaffID, OrderDate, Pants, Boots " + "VALUES (@StaffID, @OrderDate, @Pants, @Boots)";
    command.Parameters.AddWithValue("@StaffID", staffid);
    command.Parameters.AddWithValue("@OrderDate", datenow);
    command.Parameters.AddWithValue("@Pants", pant);
    command.Parameters.AddWithValue("@Boots", boot);

    command.Connection = connection;
    connection.Open();
    command.ExecuteNonQuery();

     //**********************************************************   
    if(int.Parse(bootsissued) > 0)
    {
        //Update LastBoot in StaffList with today's Date
    }
    //***********************************************************

    connection.Close();

}
catch //blah blah
我正在将记录插入StaffOrders中,但我想在订购引导时,用当前日期从StaffList更新记录LastBoot

两个表位于同一access数据库中。添加订单记录没有问题,但我似乎无法用当前日期更新LastBoot记录

我必须更新相应记录的唯一标识符是StaffID,而不是ID autonumber

StaffList:
     ID (autonumber - pk - unique)
     StaffID (indexed unique string)
     LastBoot (Date/Time)
     ...

StaffOrders:
     ID  (autonumber - pk - unique)
     StaffID (indexed unique string) - same as above
     ... (pants, boots, etc)
/*实际上,我只是在字符串更新中的变量之前错过了“标记”*/

        DateTime datenow = DateTime.Today; 

        string myconnectionstring = @"//connectionstring";
        OleDbConnection myconnection = new OleDbConnection();
        myconnection.ConnectionString = myconnectionstring;

        try
        {
            myconnection.Open();
            ConnectedIcons();

            OleDbCommand command = new OleDbCommand();
            command.Connection = myconnection;

            string update = "UPDATE StaffList SET LastBoot = '" + datenow + "' WHERE StaffID = '" + selectedstaffid + "';";
            var accessUpdateCommand = new  OleDbCommand(update, myconnection);
            accessUpdateCommand.Parameters.AddWithValue("LastBoot", datenow);
            accessUpdateCommand.Parameters.AddWithValue("StaffID", selectedstaffid);
            command = accessUpdateCommand;
            command.ExecuteNonQuery();
            myconnection.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }