Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADODB connection state property

Tags:

vb.net

adodb

I am working on an old project of my company, written in VB.NET (with no try catch block in whole app * sigh *). The basic problem is it leaves zombie process behind.

What I am suspecting is the DB call it is using i.e. ADODB connection object to query sql database.

 adoConn.Open("DSN=NameOfDatabase;UID=NameOfSA;PWD=password")

What I am thinking is to introduce a simple check for DB state. using

adoConn.State (int)

but I am not sure what are the possible values for adoConn.State. I have checked on https://msdn.microsoft.com/en-us/library/adodb._connection.state%28v=vs.90%29.aspx but no information as such.

I am well versed with C# so i though it would be like

0: closed

1: Connecting

2: Connected etc.

Any such information (with proper citation) would be really helpful.

like image 995
Bhanu Chhabra Avatar asked Oct 25 '25 03:10

Bhanu Chhabra


1 Answers

State Property (ADO) indicates for all applicable objects whether the state of the object is open or closed. If the object is executing an asynchronous method, indicates whether the current state of the object is connecting, executing, or retrieving.

Returns a Long value that can be an ObjectStateEnum value. The default value is adStateClosed.

Constant            Value            Description

adStateClosed         0              Indicates that the object is closed.
adStateOpen           1              Indicates that the object is open.
adStateConnecting     2              Indicates that the object is connecting.
adStateExecuting      4              Indicates that the object is executing a command.
adStateFetching       8              Indicates that the rows of the object are being retrieved.
like image 69
ɐsɹǝʌ ǝɔıʌ Avatar answered Oct 26 '25 17:10

ɐsɹǝʌ ǝɔıʌ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!