<html>
<title>Test</title>
<body bgcolor="FFFFFF">
<%
sort = CStr(Request("sort"))
search = CStr(Request("search"))
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=asdf;Data Source=WIN-123"
Set rs = Server.CreateObject("ADODB.Recordset")
If sort = "ascending" Then
SQL = "select top 50 * from asdf order by Name"
ElseIf (search Is Not Nothing)
SQL = "select * from asdf WHERE name = '" & search & "'"
Else
SQL = "select top 50 * from asdf"
End If
rs.open SQL, conn
%>
<center><form acion="index.asp">
Search Name:<input name="search" /><input type="submit" value="Submit" />
</form></center>
我收到一个错误
Else If (search Is Not Nothing)
线,据我所知,它应该可以工作。当然,由于某种原因,我也不能在我的服务器上浏览我的网站以查看实际错误是什么。