Private Sub FrmReg_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cboSex.SelectedIndex = 0
classconn.constate()
Button1.Enabled = False
End Sub
Public classconn As New Class1
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MsgBox("请输入注册帐号", MsgBoxStyle.OkOnly, "错误")
Else
If txtpwd1.Text = "" Then
MsgBox("请输入密码", MsgBoxStyle.OkOnly, "错误")
Else
If txtpwd2.Text = "" Then
MsgBox("重复密码不能为空", MsgBoxStyle.OkOnly, "错误")
Else
If txtpwd1.Text <> txtpwd2.Text Then
MsgBox("两次密码输入不相同,请重新输入", MsgBoxStyle.OkOnly, "错误")
txtpwd1.Focus()
Else
Dim newcommand1 As New SqlCommand With {.CommandText = "select * from QQ账户信息 where QQ号码=" & TextBox1.Text, .Connection = classconn.QqLink}
If newcommand1.ExecuteScalar <> 0 Then
MsgBox("帐号已存在,请更换", MsgBoxStyle.OkOnly, "错误")
TextBox1.Focus()
Else
Dim Country As String = TextBox3.Text
If TextBox3.Text = "" Then
Country = "null"
End If
Dim Section As String = TextBox4.Text
If TextBox4.Text = "" Then
Section = "null"
End If
Dim Old As String = TextBox5.Text
If TextBox5.Text = "" Then
Old = "null"
End If
Dim SexString As String
If cboSex.SelectedText = "男" Then
SexString = "insert into QQ账户信息(QQ号码,QQ密码,性别,国家,地区,年龄) values ('" & TextBox1.Text & "','" & txtpwd1.Text & "','男','" & Country & "','" & Section & "','" & Old & "')"
Else
SexString = "insert into QQ账户信息(QQ号码,QQ密码,性别,国家,地区,年龄) values ('" & TextBox1.Text & "','" & txtpwd1.Text & "','女','" & Country & "','" & Section & "','" & Old & "')"
End If
Dim newcommand2 As New SqlCommand With {.CommandText = SexString, .Connection = classconn.QqLink}
newcommand2.ExecuteScalar()
MsgBox("注册成功")
Me.Close()
End If
End If
End If
End If
End If
End Sub'问题是这样insert的话,数据库里的性别怎么都是女的啊?问题到底在哪里?