Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)
TrSearchData.CommandText="SELECT * FROM DreamweaverCP WHERE " _
&Trim(Request.QueryString("keyindex"))& " LIKE '%" _
&Trim(Request.QueryString("keyfield"))&"%' ORDER BY CPID ASC"
TrSearchData.Debug=true
End Sub
(读者可打开【光盘】|【源文件】|【实例 86 】|【 86.3.txt 】文件,直接复制)
提示:查询命令采用了模式匹配运算符“ LIKE ”,并结合“ % ”进行模糊查询。例如 SELECT * FROM DreamweaverCP WHERE CPFL LIKE “% 日用 %” ,该查询是要查询“ DreamweaverCP ”表里“ CPFL ”(产品分类)字段中含有“日用”二字的所有产品。