Compile function Delete_ORDER_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given ORDER record from the MSSQL database.
	
	History
	-------
	09/21/2010    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys = "SEQ":@VM:SQL_Format(Key, "INT")

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

!! Delete records from MV tables first !!

// ORDER_TABLE_SHIP_TO_ADDRESS_LINES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "ORDER_TABLE_SHIP_TO_ADDRESS_LINES", Keys)
end

// ORDER_TABLE_BILL_TO_ADDRESS_LINES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "ORDER_TABLE_BILL_TO_ADDRESS_LINES", Keys)
end

// ORDER_TABLE_ORDER_DETAIL
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "ORDER_TABLE_ORDER_DETAIL", Keys)
end

// ORDER_TABLE
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "ORDER_TABLE", Keys)
end

Return Ans
