Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

Search data from sql server using textbox in classic asp

$
0
0

I am unable to search data in asp the code is given bellow :

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Search Petition Status</title>
</head>
<body>
<form action="input.asp" method="GET" name="form1">
<table>
<tr>
<td>Full Name:</td>
<td><input name="TxtName" id="TxtName" type="text" /></td>
</tr>
</table>
<input name="button" ID="Button1" value="submit" type="Submit" />
</form>
</body>
</html>

<%
If Request.ServerVariables("REQUEST_METHOD") = "GET" then

Dim Conn, Rs, ConnString, SQL_Search
Dim name1

name1 = request.form("TxtName")
pno1 = request.form("TxtPNO")

Set Conn= Server.CreateObject("ADODB.Connection")
 ConnString = "DSN=mydsn;User Id=sa;Password=sa123;Database=mysearch"
Conn.Open  ConnString
SQL_Search= "select * from register where (TxtName like'%" + TxtName.text" or pno like'%" + TxtPNO.text + "%') "
Conn.Execute SQL_Search
response.Write(Name)

response.Write(email)
response.Write(phonenumber)
response.Write(company)
response.Write(title)
response.Write(pno)
response.End

Conn.Close
Set Conn = Nothing
Set SQL_Search = Nothing

End If
%>


Viewing all articles
Browse latest Browse all 488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>