会员注册,用户输入信息,将用户信息添加到member的SQL表中。
If name.Text = "" Or pass1.Text = "" Or pass2.Text = "" Or email.Text = "" ThenLabel6.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