I am very new to this and need a little help. I have a webform that will query a DB and return all values. I want to add a textbox so that users can use wildcards to narrow down the results that are returned. I am unsure how to get the value that is entered into the textbox to be added to the query. Here is part of what I have so far. Any help would be greatly apprciated! Thanks -e
Code:
<form action="time_to_project_by_project_number-dynamic.asp" method="POST" name="parmform">
<table border="1">
<tr>
<td>Project Number Search:</td>
<td>
<input id="txtSearch" type="text" />
<input id="btnSearch" type="button" value="Search" />
</td>
</tr>
<tr>
<td>Select Project Number(s):
</td>
<td>
<%
parmid = "P1"
provider = "MSDASQL"
datasource = "database"
username = "name"
password = "password"
databasetable = "TRANSACT"
valuedatabasecolumn = "ENTITY_NUM"
strConn = "Provider=" & provider & ";Data Source=" & datasource & ";User ID=" & username & ";password=" & password & ";"
query = "SELECT DISTINCT " & valuedatabasecolumn & "," & valuedatabasecolumn & " || ' - ' || description "
query = query & " FROM " & databasetable
query = query & " where POST_DATE >= to_date('01/01/2007', 'MM/DD/YYYY')"
set conn = Server.CreateObject("ADODB.Connection")
conn.Open strconn
set rs = conn.Execute( query )
Response.Write("<SELECT SIZE=15 NAME=" & chr(34) & parmid & chr(34) & " MULTIPLE>" & chr(13) )
rs.movefirst
do while not rs.EOF
if rs(0) <> "" then
Response.Write( "<OPTION VALUE=" & chr(34) & rs(0) & chr(34) & ">" & rs(1) & chr(13) )
end if
rs.movenext
loop
Response.Write("</SELECT>")
rs.close
set rs = nothing
set conn = nothing
%>
</td>
</tr>