|
-
Nov 20th, 2002, 09:15 AM
#1
Thread Starter
Lively Member
Error using recordset object
Hello
I am using Visual Interdev with IIS 5.0.I have a dataentry form where in
when i click the button it has to go to the next record.
My code is:
<BODY>
<%
public cn, rst, strSQL
Set cn = Server.CreateObject("ADODB.Connection")
cn.ConnectionTimeout =30
cn.open "FILEDSN=emp.dsn"
Set rst = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM employee"
rst.Open strSQL,cn
set txtemp_id.value = rst("emp_id")
set txtemp_fname.value = rst("fname")
set txtemp_lname.value = rst("lname")
%>
</BODY>
The coding in the button is
Sub btn_movenext_onclick()
rst.Open '---> Line 14
rst.MoveNext
End Sub
It is giving me the error :
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'rst'
emp_file.asp, line 14
Please let me know where i could have done the mistake.
Thanks
-
Nov 20th, 2002, 10:14 AM
#2
Hyperactive Member
hi,
hmmm.....u completley messed up with the code
This is not the way to get the next record.Use paging to move to the next record.
regds,
ashay
"If you should die before me, ask if you could bring a friend."
- Stone Temple Pilots
-
Nov 20th, 2002, 10:16 AM
#3
Frenzied Member
You are trying to do a server side operation from the client side. You can't hold a recordset open in ASP and just movenext. Each time the server sends the page to the browser, the server is no longer aware of anything that was on that page, including your recordset. Recordsets do not live between pages. (Unless you do something you shouldn't like sticking it into the session object- don't do that.)
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|