首页 >> 读书频道 >> 电脑 >> asp.net用户注册时的验证
 
· 在ASP.NET使用ja
· Asp.net组件设计浅
· 使用Server.Tra
· .Net的Outofme
· ASP.NET应用程序资
· ASP.NET用户控件返
· 如何实现Asp与Asp.
· 将一个图片按比例缩放显示
· 如何获得一个表的结构信息
· 如何在ASP.NET中显
· 实现自己的ASP.NET
· ASP.NET无法调试问
 
· 加油金顺剧情分集介绍完整
· 红楼梦:120回全本[清
· 素质教育在美国
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
· 武林寓言故事
· 2006高考录取规则
· 首批中国世界名牌产品和2
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

asp.net用户注册时的验证


查看有无更新版本

关键字:ASP.NET 2006-8-31

 

////验证用户名是否与注册数据库中的重名!!!
Private Sub check_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles check.Click
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim dbname As String
dbname = Server.MapPath("db1.mdb")
myConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:Documents and SettingsAdministratorMy DocumentsVisual Studio ProjectsWebApplication1 (2)databasedb1.mdb")数据库所在的目录
If userid.Text = "" Then
Label5.Text = "error!!you must complete it"
Else
Dim checklogin As String
checklogin = "select * from users "
Dim cmd As New OleDbCommand(checklogin, myConnection)
Dim reader As OleDbDataReader
Try
myConnection.Open()
reader = cmd.ExecuteReader()
reader.Read()
If userid.Text = reader("userid") Then
Label5.Text = "the userid had been used"
Else
Label5.Text = "this userid can use"
End If
Catch err As Exception
Trace.Write(err.Message)
Label5.Text = "checked error"
Finally
If (Not myConnection Is Nothing) Then
myConnection.Close()
End If
End Try
End If
End Sub
 
////用户注册
Private Sub regist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles regist.Click
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim dbname As String
dbname = Server.MapPath("db1.mdb")
myConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:Documents and SettingsAdministratorMy DocumentsVisual Studio ProjectsWebApplication1 (2)databasedb1.mdb")
Dim strinsert As String
strinsert = "insert into users("
strinsert &= "u_id,u_password)"
strinsert &= "values('"
strinsert &= userid.Text & "','"
strinsert &= password.Text & "')"
Dim cmd As New OleDbCommand(strinsert, myConnection)
Dim added As Integer
Try
myConnection.Open()
added = cmd.ExecuteNonQuery
If added > 0 Then
Label5.Text = "your information is added"
Response.Redirect("home.aspx")
End If
Catch err As Exception
Trace.Write(err.Message)
Label5.Text = "added error"
Finally
If (Not myConnection Is Nothing) Then
myConnection.Close()
End If
End Try
End Sub
/////
////

asp.net用户注册时的验证

[ 1 ]
asp.net用户注册时的验证 num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑