Home > Software engineering >  VB ADODC controls how disconnected after connecting to the database??????? Title must be long!!!!!!!
VB ADODC controls how disconnected after connecting to the database??????? Title must be long!!!!!!!

Time:10-11

Found after rt, compiled software installed, after each closed software in the process of task manager has the software to run, I think should be after the software to use ADODC control link to access the data without disconnection, but don't know how to disconnect, beg god to put a code!!!!!!!!!!!!!!!

CodePudding user response:

In the event of an closed write:
Set the form name=nothing
End

CodePudding user response:

reference 1st floor Leftie response:
write in closing event:
Set the form name=nothing
End
so that I can't, you look at my code
Private Sub Command4_Click ()


Dim msgQk
MsgQk=MsgBox (" are you sure you want to log off!" , 32 + vbOKCancel, "important notes")
If msgQk=1 Then

Dim cnDel1 As New ADODB. Connection
Dim rDel1 As New ADODB. You
Dim sqlDel11 As String
CnDel1. Open "DBQ=" & amp; App. The Path & amp; "\ ABC. MDB; Driver={Microsoft Access Driver (*. MDB)};"
SqlDel11="delete * from ZJM"
CnDel1. Execute sqlDel11
CnDel1. Close

Dim cnDel2 As New ADODB. Connection
Dim rDel2 As New ADODB. You
Dim sqlDel12 As String
CnDel2. Open "DBQ=" & amp; App. The Path & amp; "\ ABC. MDB; Driver={Microsoft Access Driver (*. MDB)};"
SqlDel12="delete * from PJXT"
CnDel2. Execute sqlDel12
CnDel2. Close

Dim cnDel3 As New ADODB. Connection
Dim rDel3 As New ADODB. You
Dim sqlDel13 As String
CnDel3. Open "DBQ=" & amp; App. The Path & amp; "\ ABC. MDB; Driver={Microsoft Access Driver (*. MDB)};"
SqlDel13="delete * from WBSJ"
CnDel3. Execute sqlDel13

CnDel3. Close

The Set Form1=Nothing
The Set Form2=Nothing
The Set Form3=Nothing
The Set Form4=Nothing
The Set Form5=Nothing
The Set Form6=Nothing
The Set Form7=Nothing
The Set Form8=Nothing
The Set Form9=Nothing
The Set Form10=Nothing


Unload Me
Unload Form3
Unload Form4
Unload Form5
Unload Form6
Unload Form7
Unload Form8
Unload Form9
Unload Form10

The Else
The Exit Sub
End the If

End Sub

CodePudding user response:

reference 1st floor Leftie response:
write in closing event:
Set the form name=nothing
End
Dim cnDel1 As New ADODB. Connection
Dim rDel1 As New ADODB. You
Dim sqlDel11 As String
CnDel1. Open "DBQ=" & amp; App. The Path & amp; "\ ABC. MDB; Driver={Microsoft Access Driver (*. MDB)};"
SqlDel11="delete * from ZJM"
CnDel1. Execute sqlDel11
CnDel1. Close

Dim cnDel2 As New ADODB. Connection
Dim rDel2 As New ADODB. You
Dim sqlDel12 As String
CnDel2. Open "DBQ=" & amp; App. The Path & amp; "\ ABC. MDB; Driver={Microsoft Access Driver (*. MDB)};"
SqlDel12="delete * from PJXT"
CnDel2. Execute sqlDel12
CnDel2. Close

Dim cnDel3 As New ADODB. Connection
Dim rDel3 As New ADODB. You
Dim sqlDel13 As String
CnDel3. Open "DBQ=" & amp; App. The Path & amp; "\ ABC. MDB; Driver={Microsoft Access Driver (*. MDB)};"
SqlDel13="delete * from WBSJ"
CnDel3. Execute sqlDel13

CnDel3. Close

These are used to delete the content database

CodePudding user response:

CnDel1. Close
The Set cnDel1=Nothing
.

CodePudding user response:

reference 4 floor of123 response:
cnDel1. Close
The Set cnDel1=Nothing
.
finally end behind the delete statements to solve

CodePudding user response:

Connection. The close

CodePudding user response:

, if use ado control to shut off the table to open don't need to close the database connection, exit the program, controls the resources will be released, but under the environment of the debugger, the database would have been in the open state,

USES adodb, and USES the adodc control is different,
  • Related