Compile function Copy_QUARTZ_TC_LOG_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given QUARTZ_TC_LOG record to the MSSQL database.
	
	History
	-------
	07/07/2010    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Write, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(16)
MatParse Record into Rec
					    
// List of key names and their values
Keys = "SEQ":@VM:SQL_Format(Key, "INT")

// List of data fields and their values
DataFields  = "ENTRY_ID"          :@VM:SQL_Format(Rec(1),  "STR"):@FM
DataFields := "ENTRY_DATE"        :@VM:SQL_Format(Rec(2),  "DATE"):@FM
DataFields := "ENTRY_TIME"        :@VM:SQL_Format(Rec(3),  "TIME"):@FM
DataFields := "REACTOR"           :@VM:SQL_Format(Rec(4),  "INT"):@FM
DataFields := "REPLACED_ALL"      :@VM:SQL_Format(Rec(5),  "BIT"):@FM
DataFields := "NOTES"             :@VM:SQL_Format(Rec(8),  "STR", 1):@FM
DataFields := "REPLACED_FRONT"    :@VM:SQL_Format(Rec(9),  "BIT"):@FM
DataFields := "REPLACED_SIDE"     :@VM:SQL_Format(Rec(10), "BIT"):@FM
DataFields := "REPLACED_REAR"     :@VM:SQL_Format(Rec(11), "BIT"):@FM
DataFields := "REPLACED_CENTER"   :@VM:SQL_Format(Rec(12), "BIT"):@FM
DataFields := "TC_HOURS"          :@VM:SQL_Format(Rec(13), "INT"):@FM
DataFields := "REPLACEMENT_REASON":@VM:SQL_Format(Rec(14), "STR"):@FM
DataFields := "SCHEDULED"         :@VM:SQL_Format(Rec(15), "BIT")

// Write the data to the SQL database
Ans = SQL_Write(Connection, "QUARTZ_TC_LOG", Keys, DataFields);

Return Ans
