Big problem, please help!!!

college_amy

Regular
Joined
Jan 3, 2004
Messages
83
I have a web page that allows a user to search for a service provider. when a provider is found matching their search criteria they can then choose a provider and click on their name to get more details about the provider.
What I am doing is passing their ID# to the detailsdisplay page which is formatted to display the info appropriately... but if you do a search and click on one name to get the details - you get all their details, but if you click BACK or go to do a different search and then select someone elses name to get more details the first providers details still show up.
I have tried closing the browser window and going back to the website and doing a whole new search and that doesn't even fix it... I don't know what is causing it but I can't have that happen.
Please tell me how to fix it.
Thanks.
Amy
 
It sounds like the details page has a hardcoded value on it, so that instead of the query being something like:
Code:
SELECT * FROM Item where ID = " & request("ID")

its more like:
Code:
SELECT * FROM Item where ID = 1"

Double check the details page to see if you're ALWAYS returning the same ID.

If you have SQL server, you can run the Profiler application, and view the queries that are being sent to the server.
 
Here is my code:

<%@ Page Debug="true" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Microsoft.VisualBasic.Information" %>


<SCRIPT runat="server">



Dim LoginID As String

Dim DBConnection As OleDbConnection
Dim DBCommand As OleDbCommand
Dim DBReader As OleDbDataReader
Dim SQLString As String

Dim bizname As String
Dim city As String
Dim state As String
Dim phone As String
Dim Email As String
Dim Website As String
Dim desc1 As String
Dim desc2 As String
Dim desc3 As String


Sub Page_Load

LoginID = Request.QueryString("LoginID")
If Not Page.IsPostBack Then

'Establish and open the connection
DBConnection = New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=mysource.mdb")
DBConnection.Open()


'Add four tables to the result set
SQLString = "SELECT * FROM (((Login INNER JOIN billing ON Login.LoginID = billing.LoginID) INNER JOIN info ON Login.LoginID = info.LoginID) INNER JOIN description ON Login.LoginID = description.LoginID)"
DBCommand = New OleDbCommand(SQLString, DBConnection)


'-- Create a recordset of selected records from the database and check to see if the record has null values
DBReader = DBCommand.ExecuteReader()
While (DBReader.Read())
If Not IsDBNull(DBReader("bizname")) Then
bizname = DBReader("bizname")
Else
bizname = ""

End If
If Not IsDBNull(DBReader("city")) Then
city = DBReader("city")
Else
city = ""

End If
If Not IsDBNull(DBReader("state")) Then
state = DBReader("state")
Else
state = ""

End If
If Not IsDBNull(DBReader("phone")) Then
phone = DBReader("phone")
Else
phone = ""

End If
If Not IsDBNull(DBReader("Email")) Then
Email = DBReader("Email")
Else
Email = ""

End If
If Not IsDBNull(DBReader("website")) Then
Website = DBReader("website")
Else
Website = ""

End If
If Not IsDBNull(DBReader("desc1")) Then
desc1 = DBReader("desc1")
Else
desc1 = ""

End If
If Not IsDBNull(DBReader("desc2")) Then
desc2 = DBReader("desc2")
Else
desc2 = ""

End If
If Not IsDBNull(DBReader("desc3")) Then
desc3 = DBReader("desc3")
Else
desc3 = ""

End If

End While



'Close the connection
DBReader.Close()
DBConnection.Close()
Page.DataBind()


End If

End Sub


When I passed the value to the details page from the previous this is how I did it...
<a href="details.aspx?LoginID=<%# Container.DataItem("LoginID") %>">View Details</a></td>

What did I do wrong.... I thought that if it was changed (the LoginID) that it would change the results....
 
Yeh but you aren't using it in your SQL statement. You need to add a
Code:
"WHERE logonID = " & LoginID

to the end of your SQL statement. You'll have to specify one of your login id's (cos you're using 3 or 4), but as they are all the same, it shouldn't matter which one...
 
Now I am getting the following error...
The specified field 'LoginID' could refer to more than one table listed in the FROM clause of your SQL statement.

What the heck does that mean?
 
It's because you have a loginid on every table.

Choose one of your loginID's and use that in the Where statement.

Login.LoginID
billing.LoginID
info.LoginID
description.LoginID

P.S. Don't forget to try and use MSDN. Its a great resource. :)
 
Back
Top