Forum Moderators: open

Message Too Old, No Replies

somthing wrong with this ASP code..

whats wrong with this ASP Code

         

sajuk

10:11 am on Mar 25, 2005 (gmt 0)

10+ Year Member



hi chaps,

i am trying to get this code to work, but it seems to have a problem with it, please help.
this is what i get on the page

Microsoft VBScript runtime error '800a01a8'
Object required: ''

and heres the ASP code ..

<!--#include file = "chklog.asp"-->
<!--#include file="include2.asp"-->
<% Dim Conn,rs,req,Config
req = Request("id")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.ConnectionString = "Data Source=" & Path
Conn.Open
Set Rs = Server.CreateObject("ADODB.Recordset")
Set Config= Server.CreateObject("ADODB.Recordset")
Rs.Open "SELECT * from users where cd_userid='" & req & "'", Conn, 1,3
%>

<table border="1">
<%
Do While Not rstSimple.EOF
%>
<tr>
<td><%= rstSimple.Fields("cd_userid").Value %>&nbsp;</td>
<td><%= rstSimple.Fields("txt_name").Value %>&nbsp;</td>
<td><%= rstSimple.Fields("txt_surname").Value %>&nbsp;</td>
<td><%= rstSimple.Fields("txt_street").Value %>&nbsp;</td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>
<%
' Close our recordset and connection and dispose of the objects
rstSimple.Close
Set rstSimple = Nothing
cnnSimple.Close
Set cnnSimple = Nothing

%>

lovethecoast

10:18 am on Mar 25, 2005 (gmt 0)

10+ Year Member



rstSimple has not been defined. The compiler has no clue of the methods you're trying to access.

The top half of your code uses one naming convention and the bottom uses a completely different naming convention.

sajuk

10:35 am on Mar 25, 2005 (gmt 0)

10+ Year Member



Thank you for your prompt Advice,

what would be the best way to see the results from my database, do you think you could edit that code and repost it..?Please

Thanks

Easy_Coder

2:13 pm on Mar 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Take a look at your code (YOU'VE GOT BUGS):

This don't jive:
Set Rs = Server.CreateObject("ADODB.Recordset")
Set Config= Server.CreateObject("ADODB.Recordset")
Rs.Open "SELECT * from users where cd_userid='" & req & "'", Conn, 1,3

With this:
Do While Not rstSimple.EOF

And this is not necessary:
Set Config= Server.CreateObject("ADODB.Recordset")

Unless you've got somthing going on here that we don't know about:
<!--#include file = "chklog.asp"-->
<!--#include file="include2.asp"-->

So try doing this:
Set rstSimple= Server.CreateObject("ADODB.Recordset")
Rem - Set Config= Server.CreateObject("ADODB.Recordset")
rstSimple.Open "SELECT * from users where cd_userid='" & req & "'", Conn, 1,3

sajuk

2:36 pm on Mar 25, 2005 (gmt 0)

10+ Year Member



hi,

thanks for the advice, i have got it to wrok after making some major changes, but can not get it to loop, and can only see the first users details,

this is the new code

<html>

<!--#include file = "chklog.asp"-->
<!--#include file="include2.asp"-->
<% Dim Conn,rs,Config
'req = Request("id")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.ConnectionString = "Data Source=" & Path
Conn.Open
Set Rs = Server.CreateObject("ADODB.Recordset")
Set Config= Server.CreateObject("ADODB.Recordset")
Rs.Open "SELECT * from users where cd_userid;", Conn, 1,3

%>


<% if rs.EOF Then %>

<table border="1">
<% else %><br> user ID = <%=rs("cd_userid")%>
<br>
<%=rs("txt_name")%><%=rs("txt_surname")%>

<br> <%=rs("txt_street")%>
<br> <%=rs("txt_town")%>
<br> <%=rs("txt_city")%>
<br> <%=rs("txt_country")%>
<br> <%=rs("txt_postcode")%>
<br> <%=rs("txt_tel")%>
<br> <%=rs("txt_email")%>
<br> <%=rs("txt_password")%>
<br> <%=rs("ZONE_ID")%>

<%
Rs.MoveNext

set Rs=nothing
set Config=nothing
set Conn=nothing
%>
</table>
<% end if %>

</html>

lovethecoast

4:34 pm on Mar 25, 2005 (gmt 0)

10+ Year Member



Try this

<html>

<!--#include file = "chklog.asp"-->
<!--#include file="include2.asp"-->

<%

Dim Conn, rs

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.ConnectionString = "Data Source=" & Path
Conn.Open

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * from users where cd_userid;", Conn, 1,3

Response.Write "<TABLE BORDER=1><TR><TD>"

If Not rs Is Nothing Then
If Not rs.BOF And Not rs.EOF Then
rs.MoveFirst
Do While Not rs.EOF
%>
user ID = <%=rs("cd_userid")%><BR>
<%=rs("txt_name")%> <%=rs("txt_surname")%><BR>
<%=rs("txt_street")%><BR>
<%=rs("txt_town")%><BR>
<%=rs("txt_city")%><BR>
<%=rs("txt_country")%><BR>
<%=rs("txt_postcode")%><BR>
<%=rs("txt_tel")%><BR>
<%=rs("txt_email")%><BR>
<%=rs("txt_password")%><BR>
<%=rs("ZONE_ID")%><BR>
<%
rs.MoveNext
Loop
End If
End If

Response.Write "</TD></TR></TABLE>"

Set rs = Nothing
Set conn = Nothing

%>

</html>

sajuk

4:57 pm on Mar 25, 2005 (gmt 0)

10+ Year Member



Great Stuff

what a coder,
works a treat,

Thank you Very very Much

sajuk

11:29 am on Mar 26, 2005 (gmt 0)

10+ Year Member



hi,

just when i thought it was all fine when i ran the same code on bigger DB i got another error,

Response object error 'ASP 0251 : 80004005'

Response Buffer Limit Exceeded

Execution of the ASP page caused the Response Buffer to exceed its configured limit

i think the page might be in a infinite loop.

any advice..
Thanks