Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 7th, 2003, 01:27 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default searching problem

Please help what is search coding if more files involve.
I want that when I entery the contractno it redirect to contract no file
If I entery recordno it redirect to recordno file
if I entery categroy it redirect to category file with category's value.

what will be response.redirect coding.
Please help

 <%
contractno=Request.QueryString("contractno")
contractno=Request.QueryString("contractno")
recordno=Request.QueryString("recordno")
recordno=Request.Form("contractno")
category=Request.Form("category")
category=Request.QueryString("category")

if contractno=contractno then
Response.Redirect("contno.asp?contractno")

else

Response.Redirect("searchpage.asp")

 if recordno=recordno then
 Response.Redirect("recordno.asp?recordno")

 else

 Response.Redirect("searchpage.asp")

 if category=category then
 Response.Redirect("category.asp?category")

else

Response.Redirect("searchpage.asp")


end if
end if
end if

%>

best regards.

Mateen Martin
[email protected]
 
Old June 7th, 2003, 02:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Mateen,

What are you trying to accomplish? Do you need to pass the values of contractno etc to the next page? If so, try this:

Code:
If contractno = contractno Then 
    Response.Redirect("contno.asp?contractno" & contractno)


If this is not what you want, please be more specific.

Also, can you please _not_ cross-post your messages in multiple forums? People on these lists will see your message anyway when you post it to just one list. Posting in multiple forums at the same time clutters things up, and makes it hard to give correct, centralized answers.

Cheers,

Imar
 
Old June 8th, 2003, 02:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your response.
yes I want to pass value to next page,
I will try this.

ok next time I will be careful to post the duplicate message

best regards.

Mateen Martin
[email protected]


Quote:
quote:Originally posted by Imar
 Hi Mateen,

What are you trying to accomplish? Do you need to pass the values of contractno etc to the next page? If so, try this:

Code:
If contractno = contractno Then 
    Response.Redirect("contno.asp?contractno" & contractno)


If this is not what you want, please be more specific.

Also, can you please _not_ cross-post your messages in multiple forums? People on these lists will see your message anyway when you post it to just one list. Posting in multiple forums at the same time clutters things up, and makes it hard to give correct, centralized answers.

Cheers,

Imar
 
Old June 9th, 2003, 02:32 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was try to use your coding

If contractno = contractno Then
    Response.Redirect("contno.asp?contractno" & contractno)

but it is not pass the value to next page.
only next page display.
Please send the someother coding (loop condition) which redirect the page to next page with previous page value.

best regards.

Mateen






Quote:
quote:Originally posted by mateenmohd
 thanks for your response.
yes I want to pass value to next page,
I will try this.

ok next time I will be careful to post the duplicate message

best regards.

Mateen Martin
[email protected]


Quote:
quote:Originally posted by Imar
 Hi Mateen,

What are you trying to accomplish? Do you need to pass the values of contractno etc to the next page? If so, try this:

Code:
If contractno = contractno Then 
    Response.Redirect("contno.asp?contractno" & contractno)


If this is not what you want, please be more specific.

Also, can you please _not_ cross-post your messages in multiple forums? People on these lists will see your message anyway when you post it to just one list. Posting in multiple forums at the same time clutters things up, and makes it hard to give correct, centralized answers.

Cheers,

Imar
 
Old June 9th, 2003, 02:45 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Mateen,

I think you need to rethink your strategy. The coding you have here is not going to work because it doesn't make too much sense (IMO).

Check this out:

First you get the value of contractno from the QueryString twice. Only one is necessary:

Code:
contractno = Request.QueryString("contractno")
contractno = Request.QueryString("contractno")
Suppose that contractno now contains the value of 15.

Next you compare it to itself:

Code:
If contractno = contractno Then 
    Response.Redirect("contno.asp?contractno")
Else
    ....


The If block will always be true, becuase contractno is always equal to contractno (itself), so the page will redirect.

Are you sure that Request.QueryString("contractno") contains a value on the first hit to the page? If not, contractno will be an empty string, but the code will still redirect.

Imar
 
Old June 10th, 2003, 10:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

For the transfer variable's value to the dest page try this:
Response.Redirect("contno.asp?contractno=" & contractno)
add a sign equal "=" after the variable name in the query string.


...but the Soon is eclipsed by the Moon
 
Old June 11th, 2003, 02:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please check the following asp file in the localhost just for demo. Due to connect (data) problem it will not show the data (list).
I want that I select the option, it will redirect to that page.
What logic / coding will apply. Please inform.
firstfile.asp condition.asp contractno.asp recordno.asp category.asp

If I select contractno option, it redirect to contractno.asp
If I select recordno option it redirect to recordno.asp
If I select category option it redirect to category.asp


================================================== =======

                            First page
<html>
</HEAD>
<body>
<form method=post action=search2.asp id=form name=form>

<INPUT style="WIDTH: 48px; HEIGHT: 24px" type=submit size=16 value=search id=submit1 name=submit1><INPUT style="WIDTH: 48px; HEIGHT: 24px" type=reset size=16 value=clear id=submit1 name=submit1>

<TABLE cellSpacing=1 cellPadding=1 width="680" border=1 bordercolorlight="#CCCCCC" bordercolordark="#666666">

  <TR>
    <TD width="231">Contract No :</TD>
    <TD width="333"><SELECT id=contractno name=contractno> <OPTION selected>
<%
dim ssql

set cn=server.CreateObject("adodb.connection")
cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=AUHTRIPSVR2"
cn.Open

contractno=Request.QueryString("contractno")

ssql="select distinct contractno from archive2 order by contractno"

set rs=cn.Execute(ssql)
do while rs.eof=false
Response.Write("<option value='" & rs("contractno") & "'>")
Response.Write(rs("contractno") )
rs.movenext
loop
%>

  </OPTION></SELECT></TD></TR>
    <TR>
    <TD width="231">Record Drawing No :</TD>
    <TD width="333"><SELECT id=recordno name=recordno><OPTION selected>
    <%

set cn=server.CreateObject("adodb.connection")
cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=AUHTRIPSVR2"
cn.Open

ssql="select distinct recordno from archive2 order by recordno"

set rs=cn.Execute(ssql)
do while rs.eof=false
Response.Write("<option value='" & rs("recordno") & "'>")
Response.Write(rs("recordno") )
rs.movenext
loop
%>

  </OPTION></SELECT></TD></TR>
  <TR>

    <TD width="231">Drawings Category :</TD>
    <TD width="333"><SELECT id=category name=category> <OPTION
  selected>
    <%

ssql="select distinct category from archive2 order by category"

set rs=cn.Execute(ssql)
do while rs.eof=false
Response.Write("<option value='" & rs("category") & "'>")
Response.Write(rs("category") )
rs.movenext
loop
%>

  </OPTION></SELECT></TD></TR>
  <TR>

    </TD></TR></TABLE>

</P>


</form>

</BODY>
</HTML><body background="images/radbkgnd.gif" bgcolor="#FFFFFF" text="#000000" link="#6666FF" vlink="#993333" alink="#66CCCC"></body>

================================================== =====================
                                    second page
what condition / coding will use to redirect the next page, the value which was selected from firstpage, please send.
.....
............





================================================== =======================

                            third page
get the value from the second page, and display the result. as need.


<html>
<HEAD>
</HEAD>
<BODY>

<form method=post action=wpls.asp id=form name=form>
<%

set cn=server.CreateObject("adodb.connection")
cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=AUHTRIPSVR2"
cn.Open

contractno=Request.QueryString("contractno")
contractno=Request.Form("contractno")

recordid=Request.Form("recordid")

if rs="" then
rs="-"
end if


ssql="SELECT * FROM archive2 where contractno='" &contractno & "'"

'Record Set
set rs=cn.Execute(ssql)

%>
<TABLE border=1 bordercolorlight="#669999" bordercolordark="#330066">
<tr bgcolor=gold>
<th>Contract No</th>
<th>Record Drawing No</th>
<th>Description</th>
<th>Drawing Category</th>
<th>Contractor</th>
<th>Consultant</th>
<th>Drawing No</th>
<th>ImageReference</th>
<th>Window_x1</th>
<th>Window_y1</th>
<th>Window_x2</th>
<th>Window_y2</th>
</tr>

<%


do while NOT rs.EOF

Response.Write("<tr>")
Response.Write("<td bgcolor=lightyellow>" & rs("contractno") & "</td>")
Response.Write("<td>" & rs("recordno") & "</td>")
Response.Write("<td>" & rs("description") & "</td>")
Response.Write("<td>" & rs("category") & "</td>")
Response.Write("<td>" & rs("contractor") & "</td>")
Response.Write("<td>" & rs("consultant") & "</td>")
Response.Write("<td>" & rs("drawingno") & "</td>")

Response.Write("<td>")
Response.Write("<a href=" & server.URLEncode(rs("imagereference")) & ">" & rs("imagereference") & "</a>")
Response.Write("</td>")

Response.Write("<td>" & rs("window_x1") & "</td>")
Response.Write("<td>" & rs("window_y1") & "</td>")
Response.Write("<td>" & rs("window_x2") & "</td>")
Response.Write("<td>" & rs("window_y2") & "</td>")


Response.Write("<tr>")
rs.movenext
loop
%>
</TABLE>

<INPUT id=submit2 name=submit2 type=submit value="Back" target=Right>
</P>
<P>&nbsp;</P>
</BODY>
</HTML>

</body>



Quote:
quote:Originally posted by NotNowJohn
 For the transfer variable's value to the dest page try this:
Response.Redirect("contno.asp?contractno=" & contractno)
add a sign equal "=" after the variable name in the query string.

Regards.

Mateen Martin


...but the Soon is eclipsed by the Moon





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in searching multiple keywords kumiko Classic ASP Basics 2 April 3rd, 2008 08:12 PM
Problem searching for NULL values ltdanp21 SQL Language 2 June 16th, 2004 06:52 PM
searching option problem, please help mateenmohd Classic ASP Databases 12 June 17th, 2003 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.