Home > ASP Development > what difference using recordset and not using recordset in connection???

what difference using recordset and not using recordset in connection???



set conn = Server.CreateObject("ADODB.Connection")

conn.Open ("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=sportteam;")



set rs = conn.Execute("SELECT Name_E FROM market limit 0,1")

if not rs.eof then

NameE=rs("Name_E")

end if

conn.Close

set conn = nothing





set conn = Server.CreateObject("ADODB.Connection")

conn.Open ("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=sportteam;")



set rs = Server.CreateObject("ADODB.RecordSet")

rs.open "SELECT Name_E FROM market limit 0,1",conn


if not rs.eof then

NameE=rs("Name_E")

end if

conn.Close

set conn = nothing



what difference using recordset and not using recordset in connection???



have make connection faster??

    
Guest


i don't think there is a big difference.

Was this answer helpful ? Yes No   
Guest


Infact there is no difference in those 2 statements

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by mayur_sabharwal
Infact there is no difference in those 2 statements




Yes there is.... one is less typing

Was this answer helpful ? Yes No   
Guest


If you use
set rs = conn.Execute("SELECT Name_E FROM market limit 0,1"),
the implied recordset will be automatically closed when you exit the page.

If you use
set rs = Server.CreateObject("ADODB.RecordSet")
rs.open "SELECT Name_E FROM market limit 0,1",conn,

you must explicitly close the recordset before exiting the page.

That's my understanding anyway.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved