标题:会员注册,用户输入信息,将用户信息添加到member的SQL表中。
只看楼主
家华
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-12-4
 问题点数:0 回复次数:1 
会员注册,用户输入信息,将用户信息添加到member的SQL表中。
If name.Text = "" Or pass1.Text = "" Or pass2.Text = "" Or email.Text = "" Then
            Label6.Text = "你输入的信息不正确,请重新输入!"
            name.Text = ""
            pass1.Text = ""
            pass2.Text = ""
            email.Text = ""
        Else
            If pass1.Text <> pass2.Text Then
                Label6.Text = "你两次输入的密码不同,请重新输入!"
                pass1.Text = ""
                pass2.Text = ""
                email.Text = ""
            Else
                Dim conn As New SqlConnection
                Dim cmd As New SqlCommand
                Dim str As String
                Dim dr As SqlDataReader
                conn.ConnectionString = "Data Source=A71DF09BA0DB486;Initial Catalog=bbs;Integrated Security=True"
                conn.Open()
                str = "select * from member where 昵称'" & name.Text & "'"
                cmd = New SqlCommand(str, conn)
                dr = cmd.ExecuteReader()     '出现错误。
                If dr.Read() Then
                    Label6.Text = name.Text + "已经存在,请你选择另外的昵称!"
                    conn.Close()
                    Exit Sub
                End If
                dr.Close()
                conn.Close()
                str = "insert into member values('" & name.Text & "','" & pass1.Text & "','" & email.Text & "')"
                cmd = New SqlCommand(str, conn)
                conn.Open()
                cmd.ExecuteNonQuery()
                conn.Close()
                Label6.Text = "你已经注册成功"
            End If
        End If
搜索更多相关主题的帖子: SQL member 会员 用户 注册 
2008-12-04 19:23
zuglog2133
Rank: 1
等 级:新手上路
帖 子:26
专家分:5
注 册:2008-10-10
得分:0 
首先在视图里面选择服务器资源管理器,把你要的数据库连接进你的VS2005,然后把connectionstring改一下
2008-12-05 18:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-247806-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038892 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved