Jump to content
Sign in to follow this  
Mikaymikz

How to use DBSQLExecuteError?

Recommended Posts

Can someone please tell me how to use the function "DBSQLExecuteError" in Vectorscript?

I'm not sure if I am doing it right,

but below is my sample code

which has given me two results, so far.

SAMPLE SCRIPT

PROCEDURE CheckDBError;

VAR

msg , state, internalDesc : DYNARRAY[]OF CHAR;

code : LONGINT;

error : BOOLEAN;

BEGIN

error := DBSQLExecuteError(msg, state, code, internalDesc);

AlrtDialog (Concat('Error Output = ', code));

END;

Run(CheckDBError);

===========================================================

RESULT

1. -1317141234

2. 2883687

Thanks.

Sincerely,

Mikay

Edited by Mikaymikz

Share this post


Link to post

Should be placed right after a call to an ODBC function that returns FALSE such as

IF DBSQLExecuteDSN() THEN

BEGIN

...

... {Continue code}

END

ELSE IF DBSQLExecuteError() THEN

BEGIN

...

... {Write out error information}

END;

Share this post


Link to post

Here is a sample how to use it.

PROCEDURE Test;
VAR
ok : BOOLEAN;
message, state, internalDesc : DYNARRAY[] OF CHAR;
code, colCnt, resSetInst : LONGINT;
BEGIN
ok := DBDocAddConn( 'MyTestODBCDatabase', '', '' );
ok := DBSQLExecuteDSN( 'MyTestODBCDatabase', '', '', 'SELECT * FROM Spaces', colCnt, resSetInst );
IF NOT ok THEN
BEGIN
	ok := DBSQLExecuteError(message, state, code, internalDesc);
	AlrtDialog(Concat('state: ', state, Chr(13), 'message: ', message, Chr(13), 'code: ', code, Chr(13), 'intDesc: ', internalDesc));
END;
END;

RUN(Test);

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...