...

View Full Version : Object doesn't support this property or method: 'EOF' /Default.asp, line 11



Basscyst
07-01-2004, 02:20 AM
Hello,

This is just a very simple log-in form.

I can access the fields of the record set but when I reference EOF or RecordCount I get the fore mentioned error. Can anyone tell me how I can fix this or what I am doing wrong?

Here is the code I wrote:



<!--#include virtual="db.inc"-->
<html>
<head>
<link href="login.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="main.js"></script>
</head>
<%
un=request("UserName")
pw=request("pwrd")
Set rsObj=GetSQL("SELECT * FROM prUsers WHERE prUserName='" & un & "' AND prAuthen='" & pw & "'")

if rsObj.EOF then
response.Write("Invalid user name or password!")
else
response.Write(rsObj("UserName"))
end if
%>
<div id="logMe">
<form method="post" action="default.asp">
<input type="hidden" value="" name="tmp">
<table>
<thead>
<th colspan="2">Log-In</th>
</thead>
<tr>
<td>User Name:</td>
<td><input type="text" name="username" id="username" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pwrd" id="pwrd" /></td>
</tr>
<tr>
<td colspan="2" class="btm"><input onclick="document.forms[0].tmp.value='go';" type="submit" value="Log-In" />
<input type="button" onclick="window.location.href='login.asp'" value="New Member" /></td>
</tr>
</table>
</tr>
</thead>
</table>
</form>
</div>
</body>
</html>


here is the code from the include file my buddy wrote to access the DB:



Response.ExpiresAbsolute = DateAdd("yyyy", -10, Now)

Dim sConnString
sConnString = "DRIVER={SQL Server};SERVER=******;UID=sa;PWD=*****;DATABASE=DB1"

Function GetSQL(SQL)
On Error Resume Next
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open sConnString

Set rsObj = Server.CreateObject("ADODB.Recordset")
rsObj.CursorLocation = 3

rsObj.Open SQL, oConn, 1, 3, 1
Set rsObj.ActiveConnection = Nothing
GetSQL = rsObj

oConn.Close
Set oConn = Nothing

If Err <> 0 Then
Response.Write "<BR>" & Err.Description
Response.End
End If
End Function


Thanks,
Basscyst

glenngv
07-01-2004, 09:21 AM
Change this line:

GetSQL = rsObj

to

Set GetSQL = rsObj


Use the Set keyword if you're creating objects.

Basscyst
07-01-2004, 06:13 PM
Once again Glenngv, Thank You!!! :D I can't get the smile off my face.

Basscyst



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum