<% sql="select count(*) as count from user where userid="&request.form("userid") rst.open sql,conn,1,1 rst.close if count>=0 then msgbox "用户名已存在" else msgbox "恭喜!此用户名可以使用" end if %>
现在我知道,给代码贴出来,你们也看看 rs.open "select * from [user] where userid="&"'"&userid&"'",myconn,1,1 if not rs.EOF then response.write "<script>alert('此用户名已有人注册,请重新选择')</script>"
[CODE] <% sql = "SELECT count(*) AS mycount FROM [user] WHERE userid=" & Request.Form("userid") rst.Open sql, conn, 1, 1 rst.Close If CInt(rst("mycount"))>0 Then Response.Write "用户名已存在" Else Response.Write "恭喜!此用户名可以使用" End If %> [/CODE]
if not conn.exeCute("select top 1 Userid from [user] UserName='"&UserName&"'").eof then response.write "对不起,此用户已经存在" else response.write "此用户名可以注册!" end if
这样多容易理解 [CODE]<% set rs=server.createobject("adodb.recordset") rs.open "select * from [user] where userid="&request.form("userid"),conn,1,1 if not(rs.bof and rs.eof) then response.write "用户名已存在!" end if rs.close set rs=nothing %>[/CODE]