Hi Willie,
I took your advice about cascading deletes and set up my tables
accordingly. Having tested this it works a treat but can you clarify
one thing for me.
The code I use is below
lOCAL nRecords as LONG
lOCAL oRS as ADORecordset
lOCAL oCommand as ADOCommand
lOCAL cbErr as CODEBLOCK
local lResult :=false as logic
locAL uError as USUAL
local cErrMsg as string
cbErr := ErrorBlock({|oErr|_Break(oErr)})
BEGIN SEQUENCE
oCommand :=AdoCommand{}
oCommand:ActiveConnection :=oDataConn
oCommand:CommandText :=cSql
oCommand:CommandType :=adCmdText
oCommand:CommandTimeout :=0
oRS :=oCommand:Execute(@[EMAIL PROTECTED]
)
oRS :=null_object
oCommand :=null_object
lResult :=true
ErrorBlock(cbErr)
RECOVER USING uError
ErrorBlock(cbErr)
IF IsObject(uError)
cErrMsg := "SQLConnection:ExecCommand Statement Error : " +
uError:Description +
CRLF + "Delete Instruction Failed"
ELSEIF IsString(uError)
cErrMsg := uError + CRLF + "Delete Instruction Failed"
ENDIF
ErrorBox{,cErrMsg}:show()
END SEQUENCE
return nRecords
If there are twenty records in the details file but only ten can be
deleted for whatever reason, will this leave all twenty records intact
or do I have to do some kind of rollback to recover the ten that were
deleted.
ie If it can not delete all twenty detail records it should not delete
any.
Regards,
Ian