用户注册vb.net,用户注册页面html代码
求教vb.net用户注册功能大概应该怎么实现。
你去学习如何建立窗体,如何调出窗体,隐藏窗体,等等,就可以了。如果这个些不会,你就没法做成注册的。
创新互联是一家专业提供民勤企业网站建设,专注与网站制作、成都网站设计、H5技术、小程序制作等业务。10年已为民勤众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。
vb.net怎么写注册代码
Private Sub 提交_Click()
Dim stemp As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
stemp = "select * from user"
rs.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Me!密码 确认密码 Then
MsgBox "两次输入的密码不一致,请重新输入", vbExclamation, "Error"
Exit Sub
Else
stemp = "insert into user"
stemp = stemp "(用户名,密码,身份证号)"
stemp = stemp " values('" Me!用户名 "','" Me!密码 "','" Me!身份证号 "')"
DoCmd.RunSQL stemp1
Set rs = Nothing
End If
MsgBox "The information of register have saved already!", vbExclamation, "information"
End Sub
VB.NET 注册代码
写两个函数,一个检测是否有重复用户,第二个插入
检测属用户是否存在
private function checkUser(byval uname as string) as boolean
dim sql as string = "select * from [user] where username=" uname
dim cmd as sqlcommand = new sqlcommand(sql,conn)
dim read as sqldatareader = cmd.excutereader
dim result as boolean = read.hasrows
cmd=nothing
return result
end function
新增用户
private sub adduser(byval uname as string,byval password as string)
if checkUser(uname)
messagebox.show("用户已存在")
exit sub
end if
try
dim sql as string = "insert into [user](username,password) values(@uname,@upass)"
dim cmd as sqlcommand = new sqlcommand(sql,conn)
cmd.parameters.add("@uname",sqldbtype.varchar).value=uname
cmd.parameters.add("@upass",sqldbtype.varchar).value=password
cmd.ExecuteNonQuery
cmd=nothing
messagebox.show("用户添加成功!")
catch ex As Exception
messagebox.show("用户添加失败!" + ex.message)
end try
end sub
vb.net 注册问题
改为:
sql = "insert into 表1 values(用户名='" TextBox1.Text "' ,密码='" TextBox2.Text "')"
分享题目:用户注册vb.net,用户注册页面html代码
文章分享:http://pwwzsj.com/article/dscgpeh.html