Flushing
Bart Pietercil
bart.pietercil at gmail.com
Thu May 10 06:12:01 CDT 2007
Hi,
I need some more understanding on as to WHEN to use FLush
This code worked in 2.5.9 but now raises an exception on the FLUSH
Function is in a subclass of VDatabase
Function InsertARecord(TableName As String, RecDict As Dictionary) As
integer
Dim sqlString,s As String
Dim NrOfInsertedRecords As Integer
Dim aKey As Variant
Dim arFieldNames() As String
Dim arPlaceHolders() As String
Dim arFieldValues() As String
For Each aKey in RecDict.Keys
arFieldNames.Append(str(aKey))
arPlaceHolders.Append("?")
arFieldValues.Append(RecDict.Value(aKey).StringValue)
Next
s = Join(arFieldNames,",")
sqlString = "INSERT INTO "+ TableName +"(" +s + ") VALUES (" +
Join(arPlaceHolders,",") + ")"
Try
'if not myConnection.IsConnected then
'call InitConnection()
'end if
NrOfInsertedRecords = SqlExecute(sqlString,arFieldValues)
Flush
Catch Err as VException
MsgBox(Err.Message)
Return 0
end
Return LastInsertedRecID
End Function
The NrOfInsertedRecords = 1 and Vexception is raised on FLUSH.
However it raises an empty Message
Can somebody explain what is going on (and wrong)
TIA
Bart
More information about the Valentina
mailing list