I am a bit new with asp. I am writing a search script associated with MS Access. The script searchs and displays the results, but it restricts what it will search. For example.
I have a colomn named "Drug" - lets say there are 4 drugs that start with a, and I type a in the search box. It will only display 1 drug. It also only search the first word as well. Lets say there is a drug name "Acyclovir (intravenous)" and "Acyclovir (oral)" It will only be able to search from "Acyclovir". And if I type in "Acyclovir" It will only show one of them" If you can help me it would be greatly apreciated.
Here is the code:
Code:
<form method="post" action="search.asp">
Search for <input name="fldSearch"> <input type="submit" value="Find me">
</form>
<% if Request.Form("fldSearch")<>"" then
strSearch=Request("fldSearch") %>
<h5>. . . seeking a record from the Products Table where Product Name starts with "<%= strSearch %>" </h5>
<% 'specify the provider
strProvider="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("RenalDB.mdb")
'create a recordset object
set rsProds=Server.CreateObject("ADODB.Recordset")
'set SQL Command
strSQL="SELECT * FROM RenalData WHERE Drug LIKE '%" & strSearch & "%' ORDER BY DrugID"
'open the RenalData recordset
rsProds.Open "RenalData", strProvider, 1, 3, adCmdTable
'find the record
rsProds.Find ("Drug LIKE '" & strSearch & "%'") %>
<table width="750">
<!-- begin column headers for Products table -->
<tr bgcolor="#8B99A0">
<td align="center"><b>Drug</b> <br><br> $/Dose</td>
<td align="center"><b>Usual Adult Dosage</b></td>
<td align="center"><b>CreatCl (ml/min)</b></td>
<td align="center"><b>Dosage Adjustment</b></td>
<td align="center"><b>Hemodialyis Dose</b></td>
<td align="center"><b>Ref</b></td>
</tr>
<% if not rsProds.EOF then 'display row results %>
<tr valign="top" bgcolor="#EEF8FD">
<td width="150"><b><%= rsProds ("DrugID")%></b> <b><%= rsProds ("Drug") %></b> <br><br> <%= rsProds ("$/Dose") %></td>
<td width="260"><%= rsProds ("Usual Adult Dosage") %> </td>
<td><%= rsProds ("ClCr (ml/min)") %> </td>
<td width="200"><%= rsProds ("Dosage Adjustment") %> </td>
<td width="200"><%= rsProds ("Hemodialyis Dose") %> </td>
<td><%= rsProds ("Ref") %> </td>
</tr>
<tr bgcolor="#005275">
<td colspan="6"><a href="RenalPT_1.asp" class="link">Back</a></td>
</tr>
<% else %>
<td colspan=6 align="center"><span class="head"><b>Sorry, no match found.</b></span></td></tr>
<% end if %>
</table>
<% 'close RenalData recset and flush from memory
rsProds.Close
set rsProds = Nothing
end if %>
<% if not isEmpty(Request.Form) then %>
<% end if %>
Thank you.