}//UpdateItemListToDatabase //--------------------------------------------------------------------------------------------------------------- ///<summary> /// UpdateItemToDatabase - update one record within "theTable" in the database ///</summary> ///<input>weakness r - one item to be updated within the "theTable" in the database </input> ///<input> r.currentProject - the projectId to match with one database record</input> public void UpdateItemToDatabase(weakness r) { SqlConnection myConnection = DBUtils.GetNewSqlConnection(); if (myConnection == null) { LogManager.writeToLog("New connection failed to open; in weakness_Table.cs: UpdateItemToDatabase.GetNewSqlConnection()"); return; } //WARNING: A field, like "ID", defined with "IDENTITY" semantics, cannot be assigned a value since it Auto-Increments string strQuery = "UPDATE " + theTable + " SET " + " notes=@notes," + " processArea=@processArea," + " specificGoal=@specificGoal," + " specificPractice=@specificPractice," + " genericGoal=@genericGoal," + " genericPractice=@genericPractice" + " WHERE " + " projectId=@projectId"; // <<<---- match on the Primary Key !!! TBD: This is probably NOT going to work! may keys will match on projectId???? SqlCommand myCommand = new SqlCommand(strQuery, myConnection); //WARNING: myCommand.Parameters.AddWithValue("@ID", r.ID); //cannot assign/modify a field having IDENTITY semantics myCommand.Parameters.AddWithValue("@notes", r.notes); myCommand.Parameters.AddWithValue("@processArea", r.processArea); myCommand.Parameters.AddWithValue("@specificGoal", r.specificGoal); myCommand.Parameters.AddWithValue("@specificPractice", r.specificPractice); myCommand.Parameters.AddWithValue("@genericGoal", r.genericGoal); myCommand.Parameters.AddWithValue("@genericPractice", r.genericPractice); myCommand.Parameters.AddWithValue("@projectId", r.projectId); myCommand.ExecuteNonQuery(); myConnection.Close(); }//UpdateItemToDatabase