CodeAve.com CodeAve.com - ASP - Database Table Display
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Search Database
When you're querying a Db typically you're looking for an exact match (=), less than (<), greater than (>), less than or equal to (<=), greater than or equal to (=>), or not equal to (< >). Which give you quite a number of ways that you can display your data, but with these operators a partial match is not allowed. In order to facilitate a partial match the like operator must be used and it's entirely up to you how that match is made. The example db contains most of the Titles, AirDates and What Bart Simpson writes in the blackboard at the beginning of The Simpson's (TM). 
If we were to search the db for all show titles, airdates, episode numbers and blackboards where a word in the blackboard writing starts with "will" the sql would look like this
u_search="will"
sql = "select * from shows where blackboard " like '"& u_search & "%%'"

If we were to search the db for all show titles, airdates, episode numbers and blackboards where a word in the blackboard writing ends with "will" the sql would look like this
u_search="will"
sql = "select * from shows where blackboard " like '%%"& u_search & "'"

If we were to search the db for all show titles, airdates, episode numbers and blackboards where a word in the blackboard writing contains "will" the sql would look like this
u_search="will"
sql = "select * from shows where blackboard " like '%%"& u_search & "%%'"


View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

<%
u_search=request.form("u_search")
u_where=request.form("u_where")
if u_search = "" or u_where= "" then 
response.redirect "sim_input.asp"

end if
accessdb="simpsons" 
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")

sql = "select * from shows where " & u_where &" like '%%"& u_search & "%%'" 

rs.Open sql, cn
If rs.eof then
search="nothing"
end if
%>

<title><%= sql %></title>
<body bgcolor="#FFFFFF">
<font face="arial" size="2">
<p>
<%= sql %>
</p>
</font>

<% if search <> "nothing" then %>

<div align="left">
<table border="0" cellpadding="0" cellspacing="0" width="690">
<tr>
<td width="220" valign="top" align="left"><font face="Arial" size="1"><b>Title</b></font></td>
<td width="50" valign="top" align="left"><font face="Arial" size="1"><b>Episode</b></font></td>
<td width="60" valign="top" align="left"><font face="Arial" size="1"><b>AirDate</b></font></td>
<td width="360" valign="top" align="left"><font face="Arial" size="1"><b>Black Board</b></font></td>
</tr>
<% end if %>
<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>
<tr>
<td width="220" valign="top" align="left">
<font face="Arial" size="1">
<%= rs("title") %></font></td>
<td width="50" valign="top" align="left">
<font face="Arial" size="1">
<%= rs("episode") %></font></td>
<td width="60" valign="top" align="left">
<font face="Arial" size="1">
<%= rs("airdate") %></font></td>
<td width="360" valign="top" align="left">
<font face="Arial" size="1">
<%= rs("blackboard") %></font></td>
</tr>
<%
rs.MoveNext
loop%>

<% if search = "nothing" then %>
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" width="640">
<tr>
<td valign="top" align="left">
<font face="Arial" size="2">
No Search Results Matched <%= u_search %></font></td>
</tr>

<% end if %>

</table>
</div>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3