
|
The Nature of A Recordset By 15 Seconds Discussion List |
Rating: 3.5 out of 5 Rate this article
|
email this article to a colleague
suggest an article
|
Doug Asks:
As I was working through a problem in a page today, I found myself
wondering about the nature of a non-explicitly declared recordset. I know
you can Server.CreateObject ADODB recordsets. My question is about the
recordsets instantiated via simply setting rsObj = db.Execute("stuff
here").
My assumption is that these recordsets are basic versions created by the
asp.dll as opposed to ADO(My reasoning is that if they came from the ADO
object, they would have to be explicitly created and since the only other
dll that seems to be in play is the asp.dll, it stands to reason...) . Am I
right? If so, or if not, whatever the case may be, can anyone point me to a
resource where I can learn more about these recordsets? Are they
configurable or are you locked into a 'class definition' set in stone, etc.
Ken Corrects Doug:
The Recordsets are implicitly created by ADO (just like any necessary
connection objects are implicitly created by ADO).
The properties are always the default.
David Clarifies:
Recordsets have nothing to do with ASP.dll.
Let me explain with an example and a link.
' an explicit connection object is made - ADO Connection
Set conn = Server.CreateObject("ADODB.Connection")
' a connection is opened
conn.Open strConnect
' the Execute method creates an implicit Recordset
' and rs gets a link to that recordset
Set rs = conn.Execute(SQL)
' close the implicit recordset
rs.Close
' release the tie to the variable rs
' the original recordset will be destroyed when the
' connection object goes out of scope
Set rs = Nothing
Here is a link that describes some conditions for object creation:
http://support.microsoft.com/support/kb/articles/Q191/5/72.ASP
Doug Responds:
Your example is how I create 80% of my recordsets. Having said that, apart
from obvious explicit propertying with regard to cursors and locks etc, is
there inherent issues (performace or otherwise) in using implicit rs
objects? Your link, btw, is exactly what I am looking for. I will get a tea
and begin. Thanks.
David Continues:
It is better to explicitly create your objects, like
set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
conn.Open connString
rs.Open sql, conn, adOpenForwardOnly, adLockReadOnly, adCmdText
....blah
ReleaseObj rs, True, True
ReleaseObj conn, True, True
so that you have a handle on the original object created.
But, you can do things like below and have some peace of mind because you
don't bind the internal recordset to a global/local VBScript variable
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connString
' leave implicit recordset to ADO to handle
allData = conn.Execute(sql).GetRows()
ReleaseObj conn, True, True
This conversation string was taken from the 15Seconds ASP Listserv on 2/13/01. If you have an ASP-related question or would like to share some of your knowledge with others, you may join the list by clicking here.
|
|
|
|
|
Supporting Products/Tools
|
|
Proposion N2N
|
|
Proposion N2N connects Microsoft .NET applications to Lotus Notes and Lotus Domino databases. This ADO.NET managed data provider allows you to perform blindingly fast queries and updates of Notes data from ASP.NET pages, .NET web services, Windows, or Mobile applications. An innovative SQL-like query language leverages the unique features of Notes and makes collaborative software accessible to relational database programmers.
|
[Top]
|
|
|
|
Other Articles
|
|
Sep 15, 2005 - Building an Image Keyword System
|
|
|
Unlike text-based file formats image files aren't made up of words, which makes searching for an image file by keyword difficult. Instead of being able to simply open the file to see what it contains, we're stuck looking at the text around it and other metadata to determine the image's meaning. In this article, Ziran Sun shows you how to build a simple database-based image keyword system that allows you to associate keywords with images and use these keywords to make finding images easier.
[Read This Article] [Top]
|
|
|
|
|
|
Feb 10, 2005 - A Step-by-Step Guide To Using MySQL with ASP.NET - Part 1
|
|
|
Back in the days of classic ASP, if you were building a database-driven
web site, your choice was either to invest a lot of money to get a copy of Microsoft SQL Server
(or some other enterprise-ready database) or invest a lot of time finding a way to deal with the
performance and scalability limitations of Microsoft Access. Luckily these days there's
another viable alternative: MySQL.
[Read This Article] [Top]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mailing List
Want to receive email when the next article is published? Just Click Here to sign up.
|
|