View Single Post
  #1 (permalink)  
Old February 15th, 2004, 01:20 PM
isheikh isheikh is offline
Authorized User
 
Join Date: Feb 2004
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple recordset or only one

Hi,

I have 2 different SQL statments in my ASP page. Should I create Recordset object 2 different times like I am doing down. Or Should I just make Recordset object only once and use same for all the SQL statements, which one is right and efficient way ?

Thanks

******************
Set Conn=Server.CreateObject("ADODB.Connection")
Set rsEvents = server.CreateObject("ADODB.Recordset")

Conn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=AStrongSAPwd;Initial Catalog=matrimonialSQL;Data Source=irfan-ne8ldmk8y;Initial File Name=D:\Program Files\Microsoft SQL Server\MSSQL\Data\matrimonialSQL.mdf"
str = "Select profile_id from customer_profile where profile_id ='" & profileid & "'"

rsEvents.Open str, Conn
if rsEvents.EOF Then
    profileidfound = "no"
else
    profileidfound= "yes"

end if
set rsEvents=nothing

str=""
str = "Select email_address from customer_profile where email_address ='" & emailaddress & "'"

Set rsEvents1 = server.CreateObject("ADODB.Recordset")
rsEvents1.Open str, Conn

if rsEvents1.EOF Then
    emailfound = "no"
else
    emailfound= "yes"
end if

set rsEvents1=nothing