ASP小问题请教

来源:百度知道 编辑:UC知道 时间:2024/05/13 07:00:25
<script language="javascript">

<!--
function CheckForm()
{
if (RegisterForm.UserName.value == "")
{
alert("用户名不能为空");
RegisterForm.UserName.focus();
return false;
}

else if(RegisterForm.Password.value == "")
{
alert("密码不能为空");
RegisterForm.Password.focus();
return false;
}
else if(RegisterForm.Password.value != RegisterForm.cPassword.value)
{
alert("两次输入的密码不一致,请重新输入!");
RegisterForm.Password.value = "";
RegisterForm.cPassword.value = "";
RegisterForm.Password.focus();
return false
}
else
RegisterForm.submit();

}
-->
</script>
请问如果想实现检查用户名已存在的代码,怎么加呢?谢谢!
数据库名user,有一张表user,有两个字段user和password。
这里要做的是扫描数据库中的表,如果注册的用户与数据库表中用户相同,则提示“该用户已存在”!

user=request.from("username")
select * from reg_user where username="user"

if rs("username")<>"" then
response.write("nothing")

中间代码自己完善,不会js

纯asp代码:
dim username
dim password
dim email
dim tpwd
dim tel
dim address
username=trim(request.Form("username"))
password=trim(request.Form("password"))
tpwd=trim(request.Form("tpwd"))
email=trim(request.form("email"))
tel=trim(request.Form("tel"))
address=trim(request.Form("address"))
if username="" and password="" and tpwd="" and Email="" and tel="" and address="" then
response.write("<script language='javascript'>alert('注册信息不完整!');history.back();</script>")
end if
if strcomp(cstr(request.Form("pas