我把这块程序都贴上吧,看的清楚
Public Class DBuser
Private _UserName As String
Private _Password As String
Property username() As String
Get
Return _UserName
End Get
Set(ByVal value As String)
_UserName = value
End Set
End Property
Property passward() As String
Get
Return _Password
End Get
Set(ByVal value As String)
_Password = value
End Set
End Property
Sub New(ByVal Name As String, ByVal PWD As String)
_UserName = Name
_Password = PWD
End Sub
Function LoginConfirm() As Boolean
Dim SQLString As String
SQLString = "SELECT * FROM 用户信息表 WHERE 用户名='" & _UserName & "' AND 密码='" & _Password & "'"
Dim UserTable As DataTable = DBOperation.DBOperate(SQLString)
'判断输入的信息在数据库中是否存在记录
If UserTable.Rows.Count = 0 Then
MsgBox("你输入的用户名和密码不正确,请重新输入!", MsgBoxStyle.Exclamation, "消息框")
Return False
'没有信息则返回失败,说明输入的信息不正确.
Else
Return True
End If
End Function
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class