Adding record (ASP)

R

Red_Star20

I have an ASP and an Oracle database everything is wokring ok but towards the
end of the code line 51 one is giving me an error... I cant figure out whats
wrong...

The error message:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'EOF'

/sba_home/Students/Undergraduate/international/George/International/CityAbbreviation/CityAdded.asp, line 51


Here is my code:
The top is line 51:

<%Do While NOT rsCityAdded.EOF%>
<%if rsCityAdded("City_Name") <> "" AND rsCityAdded("City_Abbreviation")
<> "" then%>
<tr>
<td align="center"><%=rsCityAdded("City_Name")%></td>
<td align="center"><%=rsCityAdded("City_Abbreviation")%></td>
</tr>
<%else%>
<%end if%>

<%rsCityAdded.moveNext()%>
<%Loop%>
 
K

Kevin Spencer

It doesn't matter what type of RecordSet you're working with. EOF is a
property of the RecordSet object.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 
K

Kevin Spencer

How about posting lines 1 - 50? How are you creating the RecordSet?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 
R

Red_Star20

there are two ASPs

here is line 1- 50 from cityadded.asp

<!-- .asp
Designed by: Adrienne DeVoe
Modified for Oracle by: Michael Durik
Updated date: March 3, 2005
Description: This allows the user to add a new city and abbreviation
to the database.
-->

<html>
<head>
<title>Add New City</title>
</head>
<!--#include file="../access/string.asp"-->

<%
Dim CityName
Dim CityAbbr
Dim TodayDate
Dim Duplicate

TodayDate = date()
CityName = (Request.Form("txtCity"))
CityAbbr = (Request.Form("txtCityAbbreviation"))
Duplicate = False

if CityName = "" OR cityAbbr = "" THEN
response.write("Invalid City or Abbreviation")
else
strSQL = "INSERT INTO group_travel(City_Name, City_Abbreviation)
VALUES('"&CityName&"', '"&CityAbbr&"')"
dbConnection.execute(strSQL)
end if

strSQL = "SELECT * FROM group_travel"
rsCityAdded = dbConnection.execute(strSQL)

%>

<body>
<table align="center" width="319">
<!--If statement displays values already in the table-->

<tr>
<td align="center" colspan="2"><b><font size="4">City Abbreviation
List</font></b></td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td align="center"><b>Location</b></td>
<td align="center"><b>Abbreviation</b></td>
</tr>


This is the other asp (addnewcity.asp)
This is the one where i add the records... the cityadded.asp then the
cityadded.asp should just
be a return page confirming the city and the abbreviation that was added...
the entries do get recorded it is just that i get these errors once i add new
values.

Here is the code for this one:

<!--AddNewCity.asp
Designed by: Adrienne DeVoe
Modified for Oracle by: Michael Durik
Updated: March 3, 2005
Description: This allows the user to add a new city and abbreviation
to the database.
-->

<html>

<head>
<title>Add New City</title>
</head>

<!--#include file="../access/string.asp"-->
<%
TodayDate = date()

'Query the database for city and abbreviation
strSQL = "SELECT * FROM group_travel Order By City_Name"
set rsAddCity = dbConnection.execute(strSQL)

%><body>
<table align="center" width="334">
<!--If statement displays values already in the table-->

<tr>
<td align="center" colspan="3"><b><font size="6">City Abbreviation
List</font></b></td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td align="center" width="198"><b><font size="4">Location</font></b></td>
<td align="center" width="126"><b><font
size="4">Abbreviation</font></b></td>
</tr>

<%Do While NOT rsAddCity.EOF%>
<%if rsAddCity("City_Name") <> "" AND rsAddCity("City_Abbreviation") <> ""
then%>
<tr>
<td align="center" width="198"><%=rsAddCity("City_Name")%></td>
<td align="center"><%=rsAddCity("City_Abbreviation")%></td>
</tr>
<%else%>
<%end if%>

<% rsAddCity.moveNext() %>
<%Loop%>
<!--No records found-->

</table>
<table align="center" width="472">
<!--Add New City-->
<form method="post" action="CityAdded.asp">
<tr><td> </td></tr>
<tr>
<td align="center" colspan="3"><b><font size="5">What city would you like
to ADD?</font></b></td>
</tr>
<tr>
<td align="center" colspan="3">*If there is more than one airport in a
city, specify the airport in parentheses.</td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td align="right"><b>City </b></td>
<td ><input type="text" name="txtCity" size="24"></td>
</tr>

<tr>
<td> </td>
<td>*Example: Chicago(Midway)</td>
</tr>
<tr>
<td align="right"><b>Abbreviation</b></td>
<td><input type="text" name="txtCityAbbreviation" size="6"></td>
</tr>
<tr>
<td height="22"> </td>
<td height="22">*Three uppercase letters</td>
</tr>
<tr><td> </td></tr>
<tr>
<td colspan="3" align="center"><input type="submit" value="Add City"></td>
</tr>
</form>
<!--Links to other pages-->
<tr><td> </td></tr>
<tr>
<td align="center" colspan="3"><A name="CancelAdd" id="CancelADd"
href=ViewCityAbbr.asp>Cancel City Add</a></td>
</tr>
<tr>
<td align="center" colspan="3"><A name="MainMenu" id="MainMenu"
href=../../ReportMainMenu.asp>Report Main Menu</a></td>
</tr>
</table>

</body>
<%
set dbConnection = nothing
%>

</html>


Here is the link: try to add a city if u want to see what happens....

http://www.sba.muohio.edu/sba_home/...International/CityAbbreviation/AddNewCity.asp


Thanks
 
K

Kevin Spencer

Here's your problem:
rsCityAdded = dbConnection.execute(strSQL)

You didn't use the "Set" operator, which creates an object. Try:

Set rsCityAdded = dbConnection.execute(strSQL)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top