Update in OleDb

AldaAlabama

Grünschnabel
Hallo,

ich habe folgendes Problem:
Der einfache Update mit variablem Inhalt(status) erfolgt einfach nicht, doch wenn ich den update hardcodiere so wie angegeben dann funktioniert es.
Auf folgende dinge habe ich schon geachtet:
-Datenbank verbindung steht und Transaktionen können durchgeführt werden
-Der Paramatertyp ist der selbe wie in der Datenbank
-Die ApplicationOID ist in der Tabelle vorhanden
-dieser hardcodierte befehl funktioniert

Code:
public bool AcceptApplication(int applicationOID,int status )
    {
      bool ok = false;
      try
      {
        using (OleDbConnection oConnection = new OleDbConnection(connectionString))
        {
          using (OleDbCommand oCommand = new OleDbCommand())
          {
            oCommand.Connection = oConnection;
                                                          //status war hier der Paramter @status
            oCommand.CommandText = "UPDATE Termine SET Status = 3 WHERE ApplicationID = @applicationID";
            oCommand.Parameters.Add("@applicationID", OleDbType.Integer).Value = applicationOID;
            //oCommand.Parameters.Add("@status", OleDbType.UnsignedTinyInt).Value = status;
            oConnection.Open();
            int updateDone = oCommand.ExecuteNonQuery();
            if (updateDone > 0)
            {
              ok = true;
            }
            oConnection.Close();
          }
        }
      }
      catch (Exception ex)
      {
        System.Diagnostics.Trace.WriteLine("Error in \"AcceptApplication\": " + ex.Message);
      }
      return ok;
    }

danke schonmal im Vorraus für eure Hilfe
 

Neue Beiträge

Zurück