Click to See Complete Forum and Search --> : How to search by keyword,and short by feilds the table


puthea
05-24-2007, 09:41 PM
hello all m a new to asp i need some help from all , if i 1 2 search text in one feild , plz help

Terrorke
05-25-2007, 01:26 AM
Do you mean in a table field?

Ifso you can create a select statement like this :

select * from tblname where column like '%searchcriteria%'

puthea
05-28-2007, 01:19 AM
thanks u !

puthea
05-28-2007, 01:54 AM
I just create an HTML form with code below
<form method="post" action="add.asp">
ID:<input type="text" name="id"><br/>
Name:<input type="text" name="name"><br/>
Sex:<input type="text" name="sex"><br/>
Description:<br/>
<TEXTAREA Rows=7 Cols=45 NAME="suggestions"></TEXTAREA><br/>
<input type="submit" name="submit" value="Submit">
</form>

and all data will sent to Add.asp bellow
<html>
<body>
<%
dim variable
variable=trim(request.QueryString("search"))
set conn=Server.CreateObject("adodb.connection")
conn.provider="microsoft.jet.oledb.4.0"
conn.open(server.mappath("db1.mdb"))
set rs=Server.CreateObject("ADODB.recordset")
sql="INSERT INTO Table1(Id,Name,"
sql=sql&"Sex,description)"
sql=&"VALUES"
sql=sql"("'&Request.form("id")&'","
sql=sql"'"&Request.form("name")&'","
sql=sql"'"&Request.form("sex")&'","
sql=sql"'"&Request.form("description")&'")"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("NO update permissions!")
else
Response.Write("<h3>"&recaffected&"record added</h3>")
end if
conn.close
%>
</body>
</html>
But it always erro at sql=&"VALUES" :confused: :) , Anybody can help me with that?

Terrorke
05-29-2007, 01:26 AM
You forgot &-sign

sql=sql&"("'&Request.form("id")&'","

Terrorke
05-29-2007, 01:28 AM
Sorry I was to fast

In the line sql=&"VALUES"

put this sql = sql & "values"
and the next line put an & -sign after the second sql

puthea
05-30-2007, 12:51 AM
nice thanks it will work !