level 10
Public Class User
Private U_IsLogin As Boolean = False
Public ReadOnly Property IsLogin() As Boolean
Get
Return U_IsLogin
End Get
End Property
Sub New(ByVal User As String, ByVal PassWord As String, ByVal HuiHuaID As Integer)
Dim Tmp = SetUserLogin(User, PassWord)
If Tmp <= 0 Then
U_IsLogin = False
Else
U_IsLogin = True
End If
End Sub
Public Sub SaveInfo(ByVal Ip As String, ByVal OrRember As Boolean)
OleGo("insert into logininfo (BodyId,Ip,DlTime) values ('" & U_UserId & "','" & Ip & "',
#" & Now & "#
)")
If OrRember Then
OleGo("Update DengLu set denglu.[OrJilu]=1,[JiLuIp]='" & Ip & "',denglu.[lastDlTime]='" & Now & "' where [编号]=" & U_UserId)
End If
End Sub
End Class '我写的登陆类
用到的两个函数:
Public Function OleGo(ByVal Sqlstr As String) As Integer
Dim Con As New OleDbConnection(Vs)
Dim Rs As New OleDbCommand(Sqlstr, Con)
If Con.State <> Data.ConnectionState.Open Then Con.Open()
Dim Bc$ = Rs.ExecuteNonQuery
Return Bc
End Function ’执行一条sql语句
Public Function SetUserLogin(ByVal User As String, ByVal PassWord As String) As Integer
Dim Tmp$ = SerchValue("select * from denglu where user='" & User & "' and password='" & PassWord & "'", "编号")
If Tmp.Trim <> "" Then
Return CInt(Tmp)
Else
Return -1
End If
End Function ‘判断账号密码是否存在,是就返回编号,不是返回-1
2013年05月04日 07点05分
4