Dim conn As New SqlConnection("server=.;database=login;integrated security=sspi")
Dim comm As New SqlCommand
Dim ds As New DataSet
Dim da As New SqlDataAdapter
Dim user, password As String
user = ComboBox1.Text
password = TextBox1.Text
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
comm.Connection = conn
comm.CommandType = CommandType.Text
comm.CommandText = "select * from Login where username = '" & user & "' and password = '" & password & "'"
da.SelectCommand = comm
If comm.CommandType <> 0 Then
MessageBox.Show("GO!")
Else
MessageBox.Show("NO!")
ComboBox1.Text = ""
TextBox1.Text = ""
ComboBox1.Focus()
Me.Focus()
End If
conn.Close()
这是button里的代码,为什么无论密码对错都是“GO”啊?
大家指点一下!谢谢~
登录功能无法实现