Compile function Delete_TW_USE_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given TW_USE record from the MSSQL database.
	
	History
	-------
	04/29/2011    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys  = "MET_NO":@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "TW_NO" :@VM:SQL_Format(Field(Key, "*", 2), "INT")

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

!! Delete records from MV tables first !!

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

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

Return Ans
