| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 555 人关注过本帖
标题:急问个关于登陆次数的问题
取消只看楼主 加入收藏
逐虞
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-6-5
收藏
 问题点数:0 回复次数:0 
急问个关于登陆次数的问题

Option Explicit
Dim n As Integer

Private Sub Form_Load()
n = 0
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command1_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrc As ADODB.Recordset
txtSQL = "select * from c001 where username='"
Trim$ (Text1(0).Text) & "'" & "and txtPassword='"
Trim$ (Text1(1).Text)
Set mrc = exeSQL(txtSQL)
If mrc.RecordCount = 0 Then '---为什么这里提示错误???
n = n + 1

If n < 3 Then
MsgBox "没有这个用户,继续登陆 ", vbOKOnly + vbExclamation, "信息提示"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(0).SetFocus

Else
MsgBox "已经登陆三次,退出系统", vbOKOnly + vbExclamation, "信息提示"
Unload Me
End If

Else
userlevel = Trim(mrc.Fields("userleve"))
mrc.Close
Unload Me
frmMain.Show
End If
End Sub

Private Sub Text1_KeyPress(intex As Integer, KeyAscii As Integer)
Call endata(KeyAscii)
End Sub


模块代码是
Option Explicit
Public userlevel As String
Public adoCon As New ADODB.Connection
Public Cmd As New ADODB.Command
Public UserCode As String
Public UserName As String
Public OldSort As Integer

Sub main()
frmLogin.Show vbModal
End Sub

Public Function ConnectString() As String

ConnectString = "FileDSN=card.dsn;UID=sa;PWD="
End Function

Public Function exeSQL(ByVal SQL As String) As ADODB.Recordset

Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
SQL = Trim$(SQL)
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conn.Open ConnectString
Set rst.ActiveConnection = conn
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset
rst.Open ConnectString
Set exeSQL = rst
Set rst = Nothing
Set conn = Nothing
End Function
Public Sub endata(Keyasc As Integer)
If Keyasc = 13 Then
SendKeys "{TAB}"
End If
End Sub

请高手帮忙修正下~~
万分感谢!!!!!


[此贴子已经被作者于2006-6-5 22:35:15编辑过]

搜索更多相关主题的帖子: 登陆 
2006-06-05 22:32
快速回复:急问个关于登陆次数的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031735 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved