Results 1 to 6 of 6

Thread: correct way to free memory

Threaded View

  1. #1

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Resolved correct way to free memory

    hello,

    can someone please tell me if the above example is totally corerct to free OLEDB connection and memory of asp.net applications?
    VB Code:
    1. 'connection
    2. Dim StrConnect as String, StrOpen as string
    3. Dim DBconn As OleDbConnection, DBcomm as OleDbCommand, DBread as OleDbDataReader
    4. StrConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=mydb.mdb"
    5.  
    6. DBconn=New OleDbConnection(StrConnect)  'connection to DB
    7. DBconn.Open()
    8. 'connect
    9. Stropen="Select * " & _
    10.    "FROM structure " & _
    11.    "WHERE " & _
    12.    "(pid = " & pid & ")"
    13. DBcomm=New OleDbCommand(Stropen,DBconn)
    14. DBread=DBcomm.ExecuteReader()
    15.  
    16. if DBread.read() then
    17.    Title.text = DBread("name")
    18. end if
    19.  
    20. DBread.close()
    21. DBconn.close()
    22.  
    23. 'free memory
    24. DBcomm.dispose()
    25. DBconn.dispose()
    26. DBread = nothing
    thank you very much,

    wc.
    Last edited by wildcat_2000; Nov 8th, 2004 at 08:03 AM.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width