index.asp:
<!--#include file="Conn/conn.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
sql="select userID from tab_user"
rs.open sql,conn,1,3
%>
<%
set rs1=server.CreateObject("adodb.recordset")
sql1="select username from tab_user"
rs1.open sql1,conn,1,3
%>
<%
set rs2=server.CreateObject("adodb.recordset")
sql2="select birthday from tab_user"
rs2.open sql2,conn,1,3
%>
<html>
<body>
<table width="526" border="0" cellpadding="0" cellspacing="0" align="center">
<form name="form1" method="post" action="delete_ok.asp" target="mainFrame">
<!--DWLayoutTable-->
<tr bgcolor="#0099CC">
<td width="526" height="6"></td>
</tr>
<tr bgcolor="#0099CC">
<td height="13" valign="top">用户查询系统>>>></td>
</tr>
<tr bgcolor="#0099CC">
<td height="9"></td>
</tr>
<tr bgcolor="#CCCCCC">
<td height="42" valign="top">
<input name="flag" type="radio" value="1" checked>用户名
<select name="select1" id="select2">
<%if not(rs.eof) then%>
<%for i=1 to rs.recordcount%>
<option value="<%=rs("userID")%>" selected><%=rs("userID")%></option>
<%rs.movenext
next
end if
%>
</select>
<input name="flag" type="radio" value="2" checked>用户名
<select name="kk1" id="kk2">
<%if not(rs1.eof) then%>
<%for i=1 to rs1.recordcount%>
<option value="<%=rs1("username")%>" selected><%=rs1("username")%></option>
<%rs1.movenext
next
end if
%>
</select>
<input name="flag" type="radio" value="3">
<input name="ff1" type="text">
<input name="bb" type="submit" class="submit" value="查询" >
</td>
</tr>
</form>
</table>
</body>
</html>
delete_ok.asp:
<!--#include file="Conn/conn.asp"-->
<%
flag=request("flag")
select1=request("select1")
kk1=request("kk1")
ff1=trim(request("ff1"))
set rs=server.CreateObject("adodb.recordset")
sql="select * from tab_user"
select case flag
case "1"
sql="select * from tab_user where userID='"&select1&"'"
case "2"
sql="select * from tab_user where username='"&kk1&"'"
case "3"
sql="select * from tab_user where username like %"&ff1&"%" '这句是不是有问题?
end select
rs.open sql,conn,1,3
%>
<table width="461" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="83" height="30" valign="top">ID</td>
<td width="87" valign="top">用户</td>
<td width="86" valign="top">性别</td>
<td width="94" valign="top">年龄</td>
<td width="111" valign="top">出生日子</td>
</tr>
<%if not(rs.eof)then%>
<%for i=1 to rs.recordcount%>
<tr>
<td height="30" valign="top"><%=rs("userID")%></td>
<td valign="top"><%=rs("username")%></td>
<td valign="top"><%=rs("sex")%></td>
<td valign="top"><%=rs("age")%></td>
<td valign="top"><%=rs("birthday")%></td>
<%rs.movenext
next
end if
%>
</tr>
</table>
好象是模糊那句有问题~不知道怎么改~
提示错误是:错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '天' 附近有语法错误。
/jian/delete_ok.asp, 第 18 行