我正在做一个数据库管理系统:我的计算机名是LMBLOOD,数据库名是:csglxt:其中有一个表的名称是userifno,登录名是sa,密码是725323。下面是一个数据库管理系统的登录代码:
Private Sub btok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btok.Click
If Me.tbname.Text.Trim() = String.Empty Then
MessageBox.Show("用户名不能为空")
Me.tbname.Focus()
ElseIf Me.tbpwd.Text.Trim() = String.Empty Then
MessageBox.Show("密码不能为空")
Me.tbpwd.Focus()
Else
Dim sql As String = "SELECT * FROM USERINFO WHERE ='" + Me.tbname.Text.Trim() + " ' AND PWD ='" + Me.tbpwd.Text.Trim() + " '"
Dim dt As DataTable = csglxt.getdatatable(sql)
If dt.Rows.Count = 0 Then
MessageBox.Show("用户名不存在或密码错误")
Me.tbpwd.Focus()
Else
If Me.rduser.Checked Then
csglxt.purview = "用户"
flag = True
Else
If dt.Select("purview = 0").Length <> 0 Then
csglxt.purview = "ADMIN"
flag = True
Else
MessageBox.Show("此用户不具备管理员权限")
flag = False
End If
End If
csglxt.userid = Me.tbname.Text.Trim()
Dim inh_main As New main
inh_main.Show()
Me.Close()
End If
End If
在运行时:始终显示的是“用户名不存在或密码错误“ 应该怎样做呀?请大家帮个忙,急,谢谢