asp中查询的问题

来源:百度知道 编辑:UC知道 时间:2024/06/17 13:03:25
我单独做了一个查询的页面,用input取值传递到下一个页面,然后用select * from products like '%"&request.querystring("t")&"%' 实现模糊查询,一般情况下输入数字和英文查询都是没有什么问题的,等到输入 ' 这些符号时网页就报错运行不了了,我想用jacascript在查询页限制一下,把包含有 ' 这个符号的数据转换成 ''这样的数据, 我知道T-SQL是可以查询把'转换成 ''进行查询的,但是我不知道怎样去实行js的转换,我对JS不是很了解,谁能教一教我,我给出查询页的代码,万分感谢啊
<title>left page</title>
<form id="form1" name="form1" method="post" action="../products/en_seachproducts.asp">
<table width="197" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20" rowspan="2" align="right"><img src="../image/1.gif" width="17" height="57" /></td>
<td height="21" colspan="2" bgcolor="#7b7b7b">Search products:
<label></label>
<

t=request.form("t")
if instr(t,"'")>0 then
response.write("<script>alert('你提交的内容中包含非法字符,请重新提交!');history.go(-1);</script>")
response.end()
end if