public Sub AddUpdate As Boolean
If mRecordID = 0 Then
cDatabase.SQLDatabase.BeginTransaction
mSQLStatement = "INSERT into " &DEFINE_DB_SystemTableName &" DEFAULT VALUES "
'------------------------------------------------------------------------------------------------------
' Insert the New record
'------------------------------------------------------------------------------------------------------
Try
cDatabase.SQLDatabase.ExecNonQuery(mSQLStatement)
cDatabase.SQLDatabase.TransactionSuccessful
cDatabase.SQLDatabase.EndTransaction
'---------------------------------------------------------------------------------------------------
' Retrieve the RecordID for the last record just Added
'---------------------------------------------------------------------------------------------------
mRecordID = cDatabase.SQLDatabase.ExecQuerySingleResult("SELECT max(RecordID) FROM " &DEFINE_DB_SystemTableName)
' If mPrinterMacAddress.Length = 0 Then
' mPrinterMacAddress = "2C:27:D7:A2:8B:50"
' End If
Catch
#If Debug
Log(LastException.Message)
#End If
CallSubDelayed3("Main", "Error_MsgBox", LastException.Message, "Database Error SystemRecord-001")
cDatabase.SQLDatabase.EndTransaction
Return False
End Try
End If
mSQLStatement = "UPDATE " &DEFINE_DB_SystemTableName &" SET " &DEFINE_DB_TagSystemFlags1 &"=" &mFlags1 &", " _
&DEFINE_DB_TagSystemFlags2 &"=""" &mFlags2 &""", " _
&DEFINE_DB_TagSystemNextDBCount &"=" &mNextDBCount &", " _
&DEFINE_DB_TagSystemPrinterMacAddress &"=""" &mPrinterMacAddress &""", " _
&DEFINE_DB_TagSystemPrinterName &"=""" &mPrinterName &""", " _
&DEFINE_DB_TagSystemLastImportedPath &"=""" &mLastImportedPath &""", " _
&DEFINE_DB_TagSystemPrinterIPAddress &"=""" &mPrinterIPAddress &""", " _
&DEFINE_DB_TagSystemPrinterIPUserID &"=""" &mPrinterIPUserID &""", " _
&DEFINE_DB_TagSystemPrinterIPPwd &"=""" &mPrinterIPPwd &""", " _
&DEFINE_DB_TagSystemPrinterIPPort &"=""" &mPrinterIPPort &""", " _
&DEFINE_DB_TagSystemMacAddress &"=""" &mMacAddress &""", " _
&DEFINE_DB_TagSystemReusePerformed &"=" &mReusePerformed &" " _
&" where " &DEFINE_DB_TagSystemRecordID &"=" &mRecordID
cDatabase.SQLDatabase.BeginTransaction
Try
cDatabase.SQLDatabase.ExecNonQuery(mSQLStatement)
cDatabase.SQLDatabase.TransactionSuccessful
cDatabase.SQLDatabase.EndTransaction
Return True
Catch
#If Debug
Log(LastException.Message)
#End If
CallSubDelayed3("Main", "Error_MsgBox", LastException.Message, "Database Error SystemRecord-002")
cDatabase.SQLDatabase.EndTransaction
Return False
End Try
End Sub