Ask a Question related to ASP, Design and Development.
-
dba #1
Question about setting a Conn = nothing
We have a component that takes in an ADO record set and returns a
dictionary object populated with the same data. My question resolves
around this practise which I see everywhere:
set conn = nothing
set dbRS = nothing
But the connection remains open till you explicitly close it right? Is
it that this is anticipating connection pooling and so you want to
clear out that thread in the pool before it services another request?
It looks like your specifically creating a null pointer? It's
everywhere in ASP code but nowhere did I find an explanation of why
you need to do this.
dba Guest
-
Basic Design Qs - XML Conn, Dataset, Buttons
I?m new to Flash and would appreciate some help if anyone would be so kind? I?ve search this forum and found answers to specific questions, but I?m... -
trouble with db conn dsn
i am working through the training from the source book with coldfushion, i have cf server set up locally on my computer, win xp pro sp2, i went to... -
Internal Server Error 500 When Creating Conn.
wot OS r u using? Have you downloaded the patch from macromedia for windows XP SP2? try that. Jay -
conn.open problem on client, not on server
I'm struggling with this problem waaaaay to long... i want to generate a letter when a button is clicked on my page. Ms Word should be opened and... -
reading sqldatareader after conn.close()
"Naveen K Kohli" <naveenkohli@hotmail.com> wrote in message news:<uDh3MJKQDHA.2476@TK2MSFTNGP10.phx.gbl>... Thanks. Can I do smt. like in code... -
Jon Wallace #2
Re: Question about setting a Conn = nothing
Hi,
Whenever you are writing code in any form (C, VB or ASP) it is good practise
to clean up after yourself instead of assuming the reletive engine will do
this for you. In the case of ASP and when referencing a database it's both
important to close the connection and then clear the data in memory once
you've finished with it. Along with performance gains (your web
applications using less runtime memory) it will also stop you running into
problems later such as trying to reuse an object that is bound to something
else for example.
So to create a nice block you would open your connection:
set oDBConn = server.createobject("adodb.connection")
oDBConn.Open sDBConnectString
oDBConn.CursorLocation=adUseClient
set oDBCmd = server.createobject("adodb.command")
Then you would user the connection
oDBCmd.ActiveConnection = oDBConn
oDBCmd.CommandText = "sp_StoredProc1"
oDBCmd.CommandType = adCmdStoredProc
oDBCmd.Parameters.Append oDBCmd.CreateParameter("@PARAM1", adInteger,
adParamInput, 4, iVal1)
oDBCmd.Parameters.Append oDBCmd.CreateParameter("@PARAM2", adInteger,
adParamInput, 4, iVal2)
oDBCmd.Parameters.Append oDBCmd.CreateParameter("@PARAM3", adInteger,
adParamInput, 4, iVal3)
set oDBRSData = server.createobject("adodb.recordset")
set oDBRSData = oDBCmd.Execute()
set oDBCmd = Nothing
Then you would use the data and then clean up
oDBRSData.Close()
set oDBRSData = Nothing
oDBConn.Close()
set oDBConn = Nothing
It's important that you close the recordset or connection before setting the
pointer to nothing, otherwise you in essense loose the pointer to the
recordset and data and can't access (or close) it then.
Hope this helps,
Jon
[url]www.insidetheregistry.com[/url]
--
"dba" <bryanmurtha@gmail.com> wrote in message
news:4697b6de-7bb2-4c27-b782-83a91e187dde@a12g2000yqm.googlegroups.com...> We have a component that takes in an ADO record set and returns a
> dictionary object populated with the same data. My question resolves
> around this practise which I see everywhere:
>
> set conn = nothing
> set dbRS = nothing
>
>
> But the connection remains open till you explicitly close it right? Is
> it that this is anticipating connection pooling and so you want to
> clear out that thread in the pool before it services another request?
> It looks like your specifically creating a null pointer? It's
> everywhere in ASP code but nowhere did I find an explanation of why
> you need to do this.
>Jon Wallace Guest



Reply With Quote

