Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Develop a search page

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-08-04, 01:13
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Develop a search page

Hi there,

I'm trying to develop a page when user can search for anything in the database.the problem i'm facing is how to display the data in a table where all the data can be in a column and row dynamically.

Thanx
Reply With Quote
  #2 (permalink)  
Old 06-08-04, 02:38
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Look up "While" loops. Once you've queried your DB, you'll have a recordset. With that recordset you can loop through it with a "While" statement to display your table:

For Example...
Code:
<table> <% '''Open a connection and query the DB for a recordset''' While NOT Recordset.EOF 'EOF = End Of File Response.Write "<tr><td>" & Recordset("Value1") & "</td></tr>" & vbCRLF Recordset.MoveNext WEnd '''Close your recordset and DB connection''' %> </table>
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 06-08-04, 20:39
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
hi there,

what if one of the record which display in the search box need to be link to another page which will tell more about the product....................how would i do that?
i mean like this:

Turkey---------------123445
Malaysia--------------211212
England---------------22122
US---------------------121212

the above is the record which are display when i key in sumting to look for it........
what should i do when i want to click Malaysia for example and i want another web page to be load to explain more about malaysia.

thanx
exactly like yahoo search page.
Reply With Quote
  #4 (permalink)  
Old 06-08-04, 20:43
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Simply make some text a link, such as the country, passing a query string value populated by the recordset. Then your detail page will use the query string value from Request.QueryString("ID") to query the database for more information.

Code:
<table> <% '''Open a connection and query the DB for a recordset''' While NOT Recordset.EOF 'EOF = End Of File Response.Write "<tr><td><a href=""detailpage.asp?ID=" & Recordset("ID") & """>" & Recordset("Value1") & "</a></td></tr>" & vbCRLF Recordset.MoveNext WEnd '''Close your recordset and DB connection''' %> </table>
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #5 (permalink)  
Old 06-09-04, 02:25
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
hi there,

Thanx for your help.I really appreciate it.
Can already.
Thanx again
Reply With Quote
  #6 (permalink)  
Old 06-18-04, 02:40
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,024
"I'm trying to develop a page when user can search for anything in the database"

And here's a related link that might hopefully help somewhat at least with building the SQL string itself:

ASP Design Tips - Search For an Expression on Multiple Fields
http://www.bullschmidt.com/devtip-se...iplefields.asp
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On