Detect Insert error using ADO

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Larry

    Detect Insert error using ADO

    I know how to detect errors if a stored procedure
    is used, by adding a ReturnValue parameter to the command object
    and then in the stored procedure having a RETURN @@ERROR

    But,

    If I am using the follwoing code in VB 6,
    How can I tell if the insert executed ok?

    I have to add error checking to a project that uses this
    type of code, I don't have time to rewrite it to use stored procedures.

    Thanks In Advance,

    Laurence Nuttall
    Programmer Analyst III
    UCLA - Division of Continuing Education

    '----------------------------------------------------------------------------

    strCommandText = "INSERT Room_Code (AttributeID, Room_ID, Install_Date,
    Uninstall_Date, Login, Modified_date)"
    strCommandText = strCommandText & " VALUES ("
    strCommandText = strCommandText & intAttributeID & ", "
    & intRoomID & ", " & strInstallDate & ", " & strUninstallDat e & ", '" &
    logon_ID & "', '" & Now() & "')"

    With mcomSQL
    .ActiveConnecti on = gconCMS
    .CommandType = adCmdText
    .CommandText = strCommandText
    Set mrsSQL = .Execute
    End With

Working...