用户注册时,如何判断用户重名?先谢谢了~~~
<%@ Import Namespace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDb" %>
<%@ page Language="VB" Debug="true"%>
<script runat="server">
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim null AS DBnull
dim username as string,password as string
sub page_load(obj as object,e as eventargs)
username = request.QueryString("username")
password = request.QueryString("password")
if(username = "" or password = "")
response.write("用户名和密码不能为空")
end if
if(username <> "" and password <>"")
dim dbname as string
dbname=server.mappath("admin/dbnews.mdb")
myConnection = New OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="&dbname )
myConnection.Open()
myCommand = New OleDbCommand( "select * FROM dbuser where dbusername="&username, myConnection )
response.write(myCommand)
'这里应该怎么判断啊?数据库是acess的
'下面是插入到数据库的东西
myCommand = New OleDbCommand( "Insert INTO dbuser(dbusername,dbpassword) Values('"& username &"','"& password &"')", myConnection )
myCommand.ExecuteNonQuery()
response.write("注册成功")
response.write(myCommand)
MyConnection.Close()
end if
end sub
</script>
如何判断用户名重名?
相关推荐
判断用户注册用户时用户名是否重名
private void button2_Click(object sender, EventArgs e) { if (this.textBox1.Text==""||this.textBox1.Text=="请输入用户名:") { MessageBox.Show("用户名不能为空!"); } string uname = this.textBox1.Text; string pwd = this.textBox3.Text; hyqpm.con.Close(); hyqpm.con.Open(); SqlCommand com = new SqlCommand("insert into admin values('"+uname+"','"+pwd+"')",hyqpm.con); if (checkuName(uname)) //判断用户名否存在 { MessageBox.Show( "用户名已存在!请重新输入:"); return; } if (this.textBox1.Text==""||this.textBox2.Text=="") { MessageBox.Show("密码不能为空!"); return; } if (com.ExecuteNonQuery()>0) { MessageBox.Show("提交成功!"); } hyqpm.con.Close(); } // 判断用户名是否存在 private bool checkuName(string name) { bool flag = false; SqlCommand com1 = new SqlCommand("select * from admin where loginid='" + this.textBox1.Text + "'", hyqpm.con); SqlDataReader dr1 = com1.ExecuteReader(); if (dr1.Read()) { flag = true; } dr1.Close(); return flag; }
检测用户注册是否重名的方法
检测系统是否有重名的用户,若有则不能注册,否则可以注册
判断用户重名 asp.net
判断用户重名 asp.net 判断用户重名 asp.net
jQuery+Ajax实现用户名重名实时检测
利用jQuery框架,封装了底层的Ajax异步技术,通过简单的方法调用即可实现。这篇博客是针对用户注册时出现的用户名重名问题的自动检测,利用的技术是Ajax异步传输。 register.jsp 注册显示页面 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <form action="login" method="pos
查找文件夹下重名(重复)文件工具
查找文件夹下重名(重复)文件工具 如果你的文件很乱,而且重复文件很多,这个工具可以帮你。 选择一个文件夹,然后找出此文件夹的重名(重复)文件。


