File : searchtmpch.asp. ID : 2507
Skin : Default | Sons-of-obsidian | Sunburst | Highlighter | Frame
<%
dim connect, rs, sql, i, nkey, newtmpch
set connect = server.createobject("ADODB.Connection")
connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &_
Server.MapPath("\perlphpasp\db\tempdb.mdb"))
sql = "select * from tempfile where (tmpch like '%" & request.form("keych") & "%')"
set rs = connect.execute(sql)
i = 1
do while not rs.eof
  nkey = "<b>" & request.form("keych") & "</b>"
  ' คำสั่ง replace ช่วยสั่งแทนที่ข้อความ ด้วยสิ่งที่ค้นหา และแทนด้วยค่าใหม่
  newtmpch = replace(rs("tmpch"),request.form("keych"),nkey)
  response.write(i&". "&newtmpch&" - "&rs("tmpnum")&" - "&rs("tmpdate")&"<br>")
  i = i + 1
  rs.movenext
loop
connect.close
set rs = nothing
set connect = nothing
%>