Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using ? in the address 1

Status
Not open for further replies.

stevenr

Technical User
Feb 21, 2001
89
0
0
GB
Does anybody know or know of any sites that can help me
with the following:
I want to make a link using <a href=&quot;page.asp&quot;> but I want it so when I click this link it automatically finds and loads the user's info into page.asp.

I believe you need a ? in the href somewhere but how does the following page get the data?
 
first page
<a href=&quot;page.asp?name=onpnt&quot;>link</a>
***to add more values to the URL sperate with & ****
***as in page.asp?name=onpnt&lastname=onpnt&quot; ****
second page
<%
dim nameValue
nameValue = request.wuerystring(&quot;name&quot;)
response.write nameValue
%>

_______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
that should be nameValue = request.querystring(&quot;name&quot;)
sorry, cold fingers
_______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
i've done that but... i'm trying to retrieve the data by using a
&quot;select * from tablename where colomn = &quot; ' & contactvalue & ' &quot;

then I've got a retrieve.fields command where I want the data retrieved to.

I get the message &quot; either BOF or EOF is true or the record has been deleted&quot; i know the record is there, and I know there's only 1 record, what else do I need?
 
did you try writing hte values passed in the querystring to validate there is a value there?
_______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
yep, using the response.write it brought up my customer name, the page works ok until I put in the retrieve.fields command.
 
you're quotes are swiched around
&quot; ' & contactvalue & ' &quot;
should be
' &quot; & contactvalue & &quot; ' _______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
Tried that, still gets the same error
 
k, I'll take that one step farther. are you closing the string? should look lie this
sqltxt = &quot;SELECT * FROM tablename WHERE colomn = '&quot; & contactvalue & &quot;' &quot;

write the sql string to the page make sure it is valid
should appear like this
SELECT * FROM tablename WHERE column = ' ' _______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
I think it may help if you posted some of your relevant code, namely where you set your SQL string and open the recordset plus where you output the rows to the page. --James
 
Just getting the code.

Here it is:

<u>Users.asp</u>

<!--#INCLUDE file=&quot;dbconnection.asp&quot;-->

<% RetrieveQuery = &quot;Select * from Name&quot;
Set Retrieve = DBObj.Execute(RetrieveQuery)
%>

<TABLE border=&quot;1&quot; width=&quot;50%&quot; align=&quot;center&quot;>
<TR>
<TD><B>Warrant No</B></TD>
<TD><B>Name</B></TD>
<TD><B>Role</B></TD>
</TR>

<% Do Until Retrieve.EOF%>

<TR>
<TD><a href=&quot;contact.asp?contact=<% = Retrieve.Fields(&quot;Warrant&quot;) %>&quot;> <% = Retrieve.Fields(&quot;Warrant&quot;) %></a> </TD>
<TD> <% = Retrieve.Fields(&quot;Name&quot;) %> </TD>
<TD> <% = Retrieve.Fields(&quot;Role&quot;) %> </TD></TR>


<% retrieve.movenext
loop %>
</TABLE>


<u>Contact.asp</U>

<!--#INCLUDE file=&quot;dbconnection.asp&quot;-->

<% dim contactvalue
contactvalue = request.querystring(&quot;contact&quot;)%>
<% RetrieveQuery = &quot;Select * from Name WHERE warrant = ' &quot; & contactvalue & &quot; ' &quot;
Set Retrieve = DBObj.Execute(RetrieveQuery)
%>
<center>Contact Details For<% = contactvalue %></center><% = Retrieve.Fields(&quot;Warrant&quot;) %>

 
see that space in between that = and the recordset. I bet that the rs is not getting wrote due to that
try
<%=Retrieve.Fields(&quot;Warrant&quot;)%> _______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
nope, still getting

&quot;either BOF or EOF is TRUE, or the record has been deleted. Requested operation requires a current record&quot;
 
alright
are you sure you have a clumn named the same as contactvalue
try trimming the variable. that is a long shot but good practice. _______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
I mean the column warrant correct.
are you sure there is a record with the value of contactvalue in the db. _______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
Just to double-check, if you Response.Write the value of RetrieveQuery in contact.asp, copy and paste it into SQL Server (or whatever DB you are using) and execute it, it DOES return a row? --James
 
[tt]

Is it not suppossed to be

<% Do while NOT Retrieve.EOF%>


and NOT

<% Do Until Retrieve.EOF%> as you have it.
* * * * * * * * * * *
<%=Tony%>
cold.gif

 
solved it,

<% RetrieveQuery = &quot;Select * from Name WHERE warrant = ' &quot; & contactvalue & &quot; ' &quot; %>

replaced with

<% RetrieveQuery = &quot;Select * from Name WHERE warrant = ( &quot; & contactvalue & &quot; ) &quot; %>

works ok now
 
Just out of curiosity, what DB are you using? Interesting to know which one uses parentheses to delimit char data rather than the standard quotes. --James
 
i'm using SQL Server 2000 with ASP Pages
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top