Compile function Copy_ATTENDANCE_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given ATTENDANCE record to the MSSQL database.
	
	History
	-------
	04/05/2010    KRF   Original Programmer
\*****************************************************************************/

$insert ATTENDANCE_EQUATES

Declare function SQL_Write, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(9)
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  = "EMPLOYEE"   :@VM:SQL_Format(Rec(ATTENDANCE_EMPLOYEE$),    "STR"):@FM
DataFields := "SHIFT"      :@VM:SQL_Format(Rec(ATTENDANCE_SHIFT$),       "INT"):@FM
DataFields := "ENTRY_ID"   :@VM:SQL_Format(Rec(ATTENDANCE_ENTRY_ID$),    "STR"):@FM
DataFields := "ENTRY_DATE" :@VM:SQL_Format(Rec(ATTENDANCE_ENTRY_DATE$),  "DATE"):@FM
DataFields := "DATE_ABSENT":@VM:SQL_Format(Rec(ATTENDANCE_DATE_ABSENT$), "DATE"):@FM
DataFields := "TYPE"	   :@VM:SQL_Format(Rec(ATTENDANCE_TYPE$),        "STR"):@FM
DataFields := "REASON"     :@VM:SQL_Format(Rec(ATTENDANCE_REASON$),      "STR"):@FM
DataFields := "EXCUSED"    :@VM:SQL_Format(Rec(ATTENDANCE_EXCUSED$),     "BIT"):@FM
DataFields := "SUPERVISOR" :@VM:SQL_Format(Rec(ATTENDANCE_SUPERVISOR$),  "STR")

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

Return Ans
