Skip to Content
author's profile photo Former Member
Former Member

GetLastError

Hi!

I use the method GetLastError but I don't know how to clear the error that this method returns.

What is the solution for this?

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 25, 2004 at 05:48 PM

    SDK-DI manual:

    "When errors occur, SAP Business One application generates an error code. Use this method to retrieve the error code with its description. If no error is found, the method returns 0 and the error message is an empty string.

    You must call this method immediately after an error occurs. Calling other methods instead, will result in the loss of the error information."

    If you know that you're doing something di-api related that could produce an error, GetLastError is useful. I think in most cases you receive a return-value from every function that changes the database somehow. If the return value is not == 0, then it's time to call GetLastError to find out what happened. You could also have a look at the manual what the return value (which is != 0) means, you should find the same information as you get from GetLastError.

    lRet = objParcelDN.Add

    If lRet <> 0 Then

    -


    Dim s As String

    -


    vCmp.GetLastError lRet, s

    -


    ShowMsg s

    End If

    In other cases, I don't see the use of GetLastError (because you don't know a context / the time / etc in which the error occured). (So there's no need to clear).

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.