Private Sub BtOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtOk.Click
Dim ob_interface As New MainForm
Try
Me.Text = "正在验证……"
Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
Dim comstr As String
Dim mydataset As New DataSet
comstr = "select 密码 from " & CmbPurview.Text & " where 用户名 = ' " & Trim(TxtUserName.Text) & " '"
mydataset.Clear()
Dim adapter As New SqlDataAdapter(comstr, SqlConnection1)
adapter.Fill(mydataset, "table1")
If mydataset.Tables("table1").Rows(0).Item(0) Is Trim(TxtPassword.Text) Then
UserInf(0) = Trim(TxtUserName.Text)
UserInf(1) = CmbPurview.Text
If CmbPurview.Text <> "管理员" Then
With ob_interface
.BtViewInf.Visible = False
.BtClientIfo.Visible = False
End With
End If
ob_interface.Show()
Me.Hide()
Else
MsgBox("密码错误!")
TxtPassword.Text = " "
Me.Text = ""
Me.Cursor = System.Windows.Forms.Cursors.Arrow
TxtPassword.Focus()
End If
Catch ex As Exception
MsgBox("用户名不存在!", MsgBoxStyle.OKOnly, "提示!")
TxtUserName.Text = ""
TxtPassword.Text = ""
Me.Text = ""
Me.Cursor = System.Windows.Forms.Cursors.Arrow
End Try
End Sub
mycom = New OleDbCommand("SELECT * FROM userset WHERE 登录名='" & txtname.Text & "'AND 密码='" & txtpwd.Text & "'", myconnect)
myadapt = New OleDbDataAdapter
myadapt.SelectCommand = mycom
ds = New DataSet()
myadapt.Fill(ds)
dt = New DataTable
dt = ds.Tables(0)
myconnect.Close()
mycom.Dispose()
If dt.Rows.Count = 1 Then
Return True
Else
If dt.Rows.Count = 0 Then
MsgBox("用户名或密码输入不正确,请重试!", MsgBoxStyle.Exclamation, "提示")
Return False
End If
End If本回答被网友采纳
数据库里面有!
本回答被提问者采纳