主题:  做搜索时,出错?

jcqcool_5d

职务:普通成员
等级:1
金币:-2.0
发贴:83
#12004/3/31 14:14:52
我这个程序一搜索姓名时就出问题?搜索数字没问题了。大家帮忙看看
================
Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e10'

[Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1。

/demo/TMPdf2wgvffpd.asp,行41

下面是我做的文件:

相关文件:点这儿打开



沉默是金

职务:普通成员
等级:6
金币:11.2
发贴:4357
#22004/3/31 15:06:51
/demo/TMPdf2wgvffpd.asp,这是个临时文件。


难人一个……

jcqcool_5d

职务:普通成员
等级:1
金币:-2.0
发贴:83
#32004/3/31 15:10:38
应该是这个文件:SearchDemo.asp
那个是我编辑这个文件时,预览时的样子。
麻烦大家帮我看看哟,谢谢



jesron

职务:普通成员
等级:2
金币:1.0
发贴:393
#42004/4/2 11:19:01
搜索字符(文本,备注型)字段应该这样子写的

where UserName like '%"&UserName&"%'

或者是

where UserName='"&UserName&"'

搜索数字型字段应该是这样子写的:
where Age="&Age&"

注意那单引号。



jcqcool_5d

职务:普通成员
等级:1
金币:-2.0
发贴:83
#52004/4/8 10:25:57
DreamweaverMX是这样生成的,我看符合你的语法呀?
======================
<%
Dim rsSearchDemo__varName
Dim rsSearchDemo__varID
Dim rsSearchDemo__varTemp
rsSearchDemo__varName = "%"
rsSearchDemo__varID = "0"
rsSearchDemo__varTemp=request.QueryString("tfSearch")
If (rsSearchDemo__varTemp <> "" and IsNumeric(rsSearchDemo_VarTemp)=True) Then
rsSearchDemo__varID =rsSearchDemo__varTemp
rsSearchDemo__varName =rsSearchDemo__varTemp
ElseIf(rsSearchDemo__varTemp <> "")then
rsSearchDemo__varName =rsSearchDemo__varTemp
End if
%>
<%
Dim rsSearchDemo
Dim rsSearchDemo_numRows

Set rsSearchDemo = Server.CreateObject("ADODB.Recordset")
rsSearchDemo.ActiveConnection = MM_SearchDemo_STRING
rsSearchDemo.Source = "SELECT a.ID,a.NAME,a.RANK,a.DEPT,a.GENDER,a.TELE,b.SALARY, b.CHANGE FROM PersonalInfo a,SalaryInfo b WHERE a.ID=b.ID AND a.NAME=b.NAME AND (a.ID=" + Replace(rsSearchDemo__varID, "'", "''") + " OR a.NAME like '%" + Replace(rsSearchDemo__varName, "'", "''") + "%') ORDER BY a.ID"
rsSearchDemo.CursorType = 0
rsSearchDemo.CursorLocation = 2
rsSearchDemo.LockType = 1
rsSearchDemo.Open()

rsSearchDemo_numRows = 0
%>
==============
可是有错,如何修正呢?



jcqcool_5d

职务:普通成员
等级:1
金币:-2.0
发贴:83
#62004/4/8 14:21:17