|
-
Nov 15th, 1999, 11:18 AM
#1
Thread Starter
Fanatic Member
Dear All...
I need some help...
How should I do if I want to check whether a connection or recordset is open or closed ?
Thx a lot...
BRgds,
Wille
Junior VB Programmer
-
Nov 15th, 1999, 11:29 AM
#2
Lively Member
which database object u r using???
if its ADO u can use state property of ADO connection object and recordset object
Thanx Manish
-
Nov 15th, 1999, 11:35 AM
#3
Thread Starter
Fanatic Member
Dear Manish,
I used ADO Connection...
I mean everytime I want to use :
Myconn.close
or
MyRecord.close
I want to check it first whether it is open or closed...
And everytime I want to open a connection or recordset, I also want to check it first...
Thx a lot...
Help me plz...
Wille
Junior VB Programmer
-
Nov 15th, 1999, 12:39 PM
#4
Lively Member
U can use the state property of the recordset and connection object
if dbConnection.state=adstateopen then
' place here the code to use existing connection
else
' place here the codes for opening a connection
endif
there are the possible values for State property
adStateOpen
adStateClose
adStateConnecting
adStateExecuting
adStateFetching
Brgds Manish
-
Nov 15th, 1999, 01:08 PM
#5
Thread Starter
Fanatic Member
Dear Manish...
You said that the statement would be like below :
if dbConnection.state=adstateopen then
' place here the code to use existing connection
else
' place here the codes for opening a connection
endif
then... I'm still confuse about the code to use existing connection....
Could u explain more... how to use existing connection ???
Thx again.....
Wille
Junior VB Programmer
-
Nov 15th, 1999, 03:38 PM
#6
Lively Member
HI
it is like this
let say u hv previously created a connection object and opened it for operations and now again u want to use that connection and u want to check if the connection is still open or not. Let say u want to open a recordset
now before setting the currentconnection property of then recordset place this code
if dbconnection.state=adStateClose then
' this part will be executed only when the the connection is close before setting the active conection property of the recordset object connection must be open...
so her place the code to open the connection then.
end if
now set the activeconnection property of the recordset.
and now open the recordset
Thanx Manish
-
Nov 15th, 1999, 04:03 PM
#7
Thread Starter
Fanatic Member
Dear Manish...
Thx for your help...
it helps me a lot...
Wille
Junior VB Programmer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|