| |

VerySource

 Forgot password?
 Register
Search
View: 825|Reply: 5

What's the difference between the two?

[Copy link]

4

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-2-16 10:00:01
| Show all posts |Read mode
dim rs as new adodb.recordset

What is the difference between rs.close and set rs = nothing?
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-18 19:00:02
| Show all posts
rs.close about connection
set rs = nothing destroy object
Reply

Use magic Report

4

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-4-19 17:00:02
| Show all posts
Are their effects the same?
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-20 08:00:01
| Show all posts
Different.

The rs.close object still exists, you can continue to use it.

The set rs = nothing object no longer exists. If you want to use it, you need to recreate it (set rs = new adodb.recordset).
Reply

Use magic Report

4

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-4-22 11:00:02
| Show all posts
I see ... thanks upstairs ...
Reply

Use magic Report

4

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-4-22 15:15:01
| Show all posts
Ask again, if defined in a private process
such as
Public Sub tab_save ()
    Dim rs_save As New ADODB.Recordset
    Dim db_save As New ADODB.Connection
    Dim connectionstring As String
    Dim sqlstring As String
    connectionstring = "provider = Microsoft.Jet.oledb.4.0; data source ="&dbname
    db_save.Open connectionstring '------------------------------- connect to adodb database
...
    Set rs_save = Nothing
    Set db_save = Nothing
End Sub

So is it right?
    Set rs_save = Nothing
    Set db_save = Nothing
Is it the same whether you write or not?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list