一个小小的登陆系统,接下来怎么绑定账号密码了?
vb.net吧
全部回复
仅看楼主
level 6
缺德的M我 楼主
该怎么做了?求代码!![委屈]
2013年05月04日 00点05分 1
level 6
缺德的M我 楼主
2013年05月04日 00点05分 2
level 6
缺德的M我 楼主
2013年05月04日 00点05分 3
你是数据库不会查询还是?所有用户的权限都可以放到数据库或者一个XML文件中,然后根据拥护名和密码查询就好了,如果查询结果不是空,就根据权限登陆就好了
2013年05月04日 12点05分
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
1