Compile function Copy_ORDER_RECON_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given ORDER_RECON record to the MSSQL database.
	
	History
	-------
	07/07/2010    KRF   Original Programmer
	04/21/2012    KRF   Dropped per David's Request, SQL_MFS Removed so this
	                    won't be called
\*****************************************************************************/

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

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

// List of data fields and their values
DataFields  = "ORDER_NO" :@VM:SQL_Format(Rec(1), "STR"):@FM
DataFields := "TIMESTAMP":@VM:SQL_Format(Rec(2), "DATETIME"):@FM
DataFields := "PROB_DESC":@VM:SQL_Format(Rec(3), "STR")

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

//-------------------------------------------------------------------------------------------------
// Multi-valued Fields

// ORDER_RECON_ITEMS
If Ans EQ "" AND Rec(4) NE "" then
    
    // List of data fields and their values
    MvFields  = "ITEM_NO":@FM:SQL_Format(Rec(4), "STR"):@RM
    MvFields := "FIELD_NAME":@FM:SQL_Format(Rec(5), "STR"):@RM
    MvFields := "VISION_VALUE":@FM:SQL_Format(Rec(6), "STR"):@RM
    MvFields := "OI_VALUE":@FM:SQL_Format(Rec(7), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "ORDER_RECON_ITEMS", Keys, MvFields);
    
end

Return Ans
