Compile function Copy_REACT_READS_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given REACT_READS record to the MSSQL database.
	
	History
	-------
	08/09/2010    KRF   Original Programmer
\*****************************************************************************/

$insert REACT_READS_EQUATES

Declare function SQL_Write, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(4)
MatParse Record into Rec
					    
// List of key names and their values
Keys  = "REACT_NO":@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "READ_DTM":@VM:SQL_Format(Field(Key, "*", 2), "DATETIME")

// List of data fields and their values
DataFields  = "HOURS"  :@VM:SQL_Format(Rec(REACT_READS_HOURS$),   "STR"):@FM
DataFields := "CYCLES" :@VM:SQL_Format(Rec(REACT_READS_CYCLES$),  "STR"):@FM
DataFields := "READ_BY":@VM:SQL_Format(Rec(REACT_READS_READ_BY$), "STR")

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

Return Ans
