Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text field with a button search

Status
Not open for further replies.

Tarzan613

Programmer
Jun 10, 2002
10
0
0
US
How can I create a text field with a button "search" on the Web.
The thing is I will need to retrive a records from my SQL table and when I will be clicking Search I want fields top show up on my page from this table..

Thanks a lot,
Bob
 
Create a text box and submit button, on click
use method ="post"
next page
use request.form("Name of tHE text field")

u can use ADO to connect to ur database
% Set Conn = Server.CreateObject("ADODB.Connection")

' The following line must be changed to reflect your data source info
Conn.Open "dsnname", "Login", "PASSWWD"
set cmd = Server.CreateObject("ADODB.Command")

set cmd.ActiveConnection = Conn
' Specify the name of the stored procedure you wish to call

cmd.CommandType = 4
cmd.CommandText = "sp_YOUR STOREDPROCEDURE"
cmd.parameters.refresh
cmd.parameters(1).value= Request.form("yourtextboxname")
set rs=cmd.execute()
rs.movefirst
do while not rs.eof
response.write(rs(0))
rs.movenext
loop


</Form>

and the stored procedure which u will call will accept one parameter and it will contain

select * from yourtablename where field=@textbox



Try this
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top