LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sql code error

Hi,

 

I am working with the Database Toolset for a Labview 7.1 application. I would like to know if it is possible to catch real server error code from SQL server 2000.

 

Example: 

 

for a code SQL = 1105, "Can't allocate space for object '???' in database ‘???' because the 'system segment is full …'” «,

 

I get the Labview code error -2147217900.  I attemp for error code 1105....

 

Thanks for any help.

0 Kudos
Message 1 of 6
(3,276 Views)
The error code is not the LV error code, but the ADO (ActiveX Data Object) error code. LV uses ADO to access all types of databases and as a result I don't think it has any inherent way of extracting SQL-server-specific error codes. Maybe somewhere in the ADO hierarchy there is a property or method which does return the error code specific to the provider, but I doubt it.
Still, it is possible, so you can try digging around a bit to see if this does exist.

___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,263 Views)
Thanks.
 
I found some ADODB._Errors ActiveX class, but I dont understand how to use it correctly.  For instance, I try to make an insert error in order to get information about this class, for Item, Description, NativeError,
0 Kudos
Message 3 of 6
(3,231 Views)
Thanks.
 
I found some ADODB._Errors ActiveX class, but I dont understand how to use it correctly.  For instance, I try to make an insert error in order to get information about this class, for Item: Description, NativeError, Number, SQLState and Source.
 
Thanks a lot to see my test.vi and for any help.
0 Kudos
Message 4 of 6
(3,230 Views)

I really have no idea.

The ADO hierarchy is probably at least partially documented on the MSDN site, so you might try reading up on it there.

You might wish to consider whether you really want the original error codes. Part of the advantage of working with abstraction layers like ADO is that they allow you not to be dependant on a single source (in this case, a specifc DB). It might be preferable just to find out what the ADO error codes mean and use them. You can then make a utility out of this which will return standard error messages (although I'm a bit surprised that the NI VIs don't have this internally).

One thing to note (although I understand this is only an example and it is probably irrelevant in this case) is that you're not closing the command object reference returned from the Execute method.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(3,223 Views)

OK.

While I dont get a better way to go ahead, I have to use the Error Message (String) for errors managing.  The problem is  that I have to get it in two Languages (English and French).   I would prefer get the SQL native error number code, because it is the same for any languages and it is also more specific.

Yhanks for your attention.

 

 

0 Kudos
Message 6 of 6
(3,219 Views)