Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which Connection is better?

Status
Not open for further replies.

Taco

Programmer
Apr 1, 2001
32
US
Would someone be able to tell me the differences between the below methods. I always thought that the .execute method was more efficient especially for simple retrievals of data.

Set rs=server.createobject("ADODB.recordset")
sqlstr = "select * from table"
set rs = Conn.execute(sqlstr)

Set rs=server.createobject("ADODB.recordset")
sqlstr = "select * from table"
rs.Open sqlstr,Conn
 
If I'm not mistaken, using the Execute method of the connection object gives you a read-only recordset. You cannot add/update/delete records.
BTW, you don't need the:

Set rs=server.createobject("ADODB.recordset")

...for the Execute method
 
If i were you i would use the second method but with some changes.
Code:
Set rs=server.createobject("ADODB.recordset") 
sqlstr = "select * from table"
rs.Open sqlstr,Conn,3,3
the 3,3 parameters gives you access to all the Recordset objects methods,features and properties.
You can use RecordCount to get nr of the records, AddNew, Update, Filter and many other.


________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top