[thelist] Insert Nothing
Ken Schaefer
ken at adOpenStatic.com
Tue Sep 28 19:11:55 CDT 2004
----- Original Message -----
From: "Joshua Olson" <joshua at waetech.com>
Subject: RE: [thelist] Insert Nothing
:> -----Original Message-----
: > From: Ken Schaefer
: > Sent: Tuesday, September 28, 2004 2:09 AM
:
: > Your code, if you use a recordsetm it should look like:
:
: > Set objConn = Server.CreateObject("ADODB.Connection")
: > objConn.Open <conn string>
:
: > Set objRS = Server.CreateObject("ADODB.Recordset")
: > Set objRS.ActiveConnection = objConn ' <- note Set
:
: Ken,
:
: Is there anything inherently wrong with the following code?
:
: Set objConn = Server.CreateObject("ADODB.Connection")
: objConn.Open <conn string>
:
: objConn.Execute <sql string>
: objConn.Close
: Set objConn = Nothing
There is nothing wrong with the above.
: ' or instead of just the previous line, perhaps:
:
: ' Set objRS = objConn.Execute(<sql string>)
: ' objRS.Close
: ' Set objRS = Nothing
This I don't think is worth doing when you are doing an
INSERT/UPDATE/DELETE. Those types of action queries do not return a
resultset, so you are just unnecessarily creating an ADO recordset and then
throwing it away. Extra object creation, extra lines of code, extra typing
for no benefit that I can see...
Cheers
Ken
More information about the thelist
mailing list