Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: the EOF is not working


Message #1 by "Shabbir" <jamali_s@y...> on Fri, 19 Jul 2002 22:00:19
hi
well i have a problem with the following code. it says that the EOF 
object does not work . why is that so ..... i am indicating the line 
where i had encountered that error

thanks
shabbir

<% @language="vbscript" %>


</HEAD>

<BODY>
<%
dim objcommand,rec_set,conn 
set conn=server.createobject("adodb.connection")
set rec_set=server.createobject("adodb.recordset")
search_var=request.form("director")
conn.open "dsn=shabs"
rec_set.open "movie",conn,1,3,2

set objcommand=server.createobject("adodb.command")
objcommand.activeconnection=conn
objcommand.commandtext="movie"
objcommand.commandtype=2

rec_set=objcommand.execute

set objcommand=nothing

while not rec_set.eof           '***** this the line 
response.write rec_set("title") & ("<br>")
rec_set.movenext
wend

rec_set.close
set rec_set=nothing
%>

</BODY>
</HTML>
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 22 Jul 2002 11:57:06 +1000
When you do:

rec_set=objcommand.execute

you are doing an implicit let. You want to do a Set (ie set rec_set to be a
reference to the object returned by calling the .Execute method):

<%
Set rec_set = objCommand.Execute
%>

is what you want.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Shabbir" <jamali_s@y...>
Subject: [asp_databases] the EOF is not working


: hi
: well i have a problem with the following code. it says that the EOF
: object does not work . why is that so ..... i am indicating the line
: where i had encountered that error
:
: thanks
: shabbir
:
: <% @language="vbscript" %>
:
:
: </HEAD>
:
: <BODY>
: <%
: dim objcommand,rec_set,conn
: set conn=server.createobject("adodb.connection")
: set rec_set=server.createobject("adodb.recordset")
: search_var=request.form("director")
: conn.open "dsn=shabs"
: rec_set.open "movie",conn,1,3,2
:
: set objcommand=server.createobject("adodb.command")
: objcommand.activeconnection=conn
: objcommand.commandtext="movie"
: objcommand.commandtype=2
:
: rec_set=objcommand.execute
:
: set objcommand=nothing
:
: while not rec_set.eof           '***** this the line
: response.write rec_set("title") & ("<br>")
: rec_set.movenext
: wend
:
: rec_set.close
: set rec_set=nothing
: %>
:
: </BODY>
: </HTML>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index