BD remains open after SELECT

Please support our MS Access and FileMaker Pro advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jun 2007
Posts: 28
Reputation: ViRiPuFF is an unknown quantity at this point 
Solved Threads: 0
ViRiPuFF ViRiPuFF is offline Offline
Light Poster

BD remains open after SELECT

 
0
  #1
Apr 29th, 2009
I am using the following code to retrieve the last entered value from a table and insert it into a textbox called rf.

The code below works but the DB remains open until I restart my computer.

Sub Page_Load()

If Request.QueryString("VesselName") Is Nothing Then
            VesselName.Text = "Blank Name" 'some default value
        Else
            VesselName.Text = Request.QueryString("VesselName")

        End If
		
		'construct the command object and open a connection to the Returns table
        Dim dbconn, sql, dbcomm, dbread
        dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("AnnexII.mdb"))

        dbconn.Open()
        sql = "SELECT Ref FROM Returns WHERE VesselName = '" & Trim(VesselName.Text) & "'"

       
        dbcomm = New OleDbCommand(sql, dbconn)
        dbread = dbcomm.ExecuteReader()


        If dbread.Read Then
            rf.Text = dbread(0)


            dbread.Close()

            dbconn.Close()
	
       End If

	   

End Sub
</script>

THanks ViRiPuFF
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 28
Reputation: ViRiPuFF is an unknown quantity at this point 
Solved Threads: 0
ViRiPuFF ViRiPuFF is offline Offline
Light Poster

Re: BD remains open after SELECT

 
0
  #2
Apr 29th, 2009
The Title should read DB ot BD sorry

ViRiPuff
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MS Access and FileMaker Pro Forum


Views: 604 | Replies: 1
Thread Tools Search this Thread



Tag cloud for MS Access and FileMaker Pro
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC