OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

What's can be wrong here?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> What's can be wrong here?
Page: [1]
 
mrjoe

 

Posts: 79
From: None
Status: offline

 
What's can be wrong here? - 7/25/2001 17:03:00   
I am sorry to keep bugging you all, but I tried to solve this myself...anyway.

I know for a "fact" the record exist in the table named "Locations" and the field name "FriendID" is correct, however using the sql statement below, I get the "no records found" message. This ID field is a link between two tables and is of type "longint".

I am all mixed up???

<%
set conntemp=server.createobject("adodb.connection")
myconnect ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\fpdb\pfdb1.mdb") & ";"
conntemp.Open myconnect
sqltemp="select * from Locations where FriendID="
sqltemp=sqltemp & Session("UserID") & ""
set rstemp=conntemp.execute(sqltemp)
if rstemp.eof then
response.write "No records found<br>"
response.write sqltemp & "<br>So cannot make table..."
conntemp.close
set conntemp=nothing
response.end
end if
%>

Spooky

 

Posts: 26681
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: What's can be wrong here? - 7/25/2001 18:07:00   
You are doing an if eof -> write "No records"

But you dont actually appear to do anything if you find a record?
Is there some code missing?

------------------
§þððk¥
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!
VP-ASP Shopping cart


(in reply to mrjoe)
mrjoe

 

Posts: 79
From: None
Status: offline

 
RE: What's can be wrong here? - 7/26/2001 20:18:00   
Here is the rest of the code:

' This get info from a previous form
<%
FirstName=request.form("FirstName")
LastName=request.form("LastName")
Location=request.form("Location")
City=request.form("City")
State=request.form("State")
YearBox=request.form("YearBox")

' this code opens the the db
set conntemp=server.createobject("adodb.connection")
myconnect ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\fpdb\pfdb1.mdb") & ";"
conntemp.Open myconnect

' this code retrieves the ID number from table UserDB assigned by Access
' based on a unique user email and assigns it to "UserID"
sqltemp="select * from UserDB where EmailAddress='"
sqltemp=sqltemp & Session("UserEmail") & "'"
set rstemp=conntemp.execute(sqltemp)
Session("UserID")=rstemp("UserID")

' this code adds the info from the previous form into the Locations table plus
' the UserID from UserDB table, that way you can have a single user with many locations
sqltemp="Insert Into Locations (UserID, FirstName, LastName, Location, L1City, L1State, L1Year) Values ("&Session("UserID")&", '"&FirstName&"', '"&LastName&"', '"&Location&"', '"&City&"', '"&State&"', '"&YearBox&"')"
set rstemp=conntemp.execute(sqltemp)

' close the db connection
set rstemp=nothing
set conntemp=nothing
%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Add Next</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Theme" content="globalbusiness1 010, default">
</head>

' this code reopens the db
<%
set conntemp=server.createobject("adodb.connection")
myconnect ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\fpdb\pfdb1.mdb") & ";"
conntemp.Open myconnect

' this code should grab the record(s) from the table Locations based on "UserID" from above
' and checks if no records are found
sqltemp="select * from Locations where UserID="
sqltemp=sqltemp & Session("UserID") & ""
set rstemp=conntemp.execute(sqltemp)
if rstemp.eof then
response.write "No records found<br>"
response.write sqltemp & "<br>So cannot make table..."
conntemp.close
set conntemp=nothing
response.end
end if
%>

Locations you currently added.</font>
</p>
<!--mstheme--></font><table width="100%" border="0">
<thead>
<tr>
<td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">Location</font></b><!--mstheme--></font></td>
<td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">City</font></b><!--mstheme--></font></td>
<td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">State</font></b><!--mstheme--></font></td>
<td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">Year</font></b><!--mstheme--></font></td>
</tr>
</thead>
<tbody>

' finally, this code creates the table to display the record(s)
<%
do until rstemp.eof
tempLocation=rstemp("Location")
tempCity=rstemp("L1City")
tempState=rstemp("L1State")
tempYear=rstemp("L1Year")
cellstart="<td align=""top"">"
response.write "<tr>"
response.write cellstart & tempLocation & "</td>"
response.write cellstart & tempCity & "</td>"
response.write cellstart & tempState & "</td>"
response.write cellstart & tempYear & "</td>"
response.write "</tr>"
rstemp.movenext
loop
%>
</table><!--mstheme--><font face="Arial, Arial, Helvetica">

' close the connection
<%
set rstemp=nothing
set conntemp=nothing
%>


</html>


(in reply to mrjoe)
mrjoe

 

Posts: 79
From: None
Status: offline

 
RE: What's can be wrong here? - 7/26/2001 20:21:00   
Oh, one more thing, right now there is only one record to retrieve, would make a difference? In other words, would rstemp.eof be "true" if there only one record in the table?

Just a thought.


(in reply to mrjoe)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> What's can be wrong here?
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts