打印

模块这个里面的这段好像没起作用

模块这个里面的这段好像没起作用

Public Sub deldata(ByVal tn As String)
Dim sql As String
sql = "delete" & Trim$(tn)
Set conn = New ADODB.Connection
conn.ConnectionString = "dsn=ks;uid=sa;pwd=;"
conn.Open
conn.Execute sql
If Trim(tn) = "oper" Then
sql = "insert oper values('1234','1234','系统管理员')"
conn.Execute sql
End If
conn.Close
End Sub
不能更改数据

TOP

Public userlevel As String
Public flag As Integer
Public num As Integer
Public condstr As Integer
Public recs As Integer
Public sel As Boolean
Public n As Integer
Public Function exesql(ByVal sql As String) As ADODB.Recordset
sql = Trim$(sql)
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conn.ConnectionString = "dsn=ks;uid=sa;pwd=;"
conn.Open
Set rst.ActiveConnection = conn
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset
rst.Open sql
Set exesql = rst
Set rst = Nothing
Set conn = Nothing
End Function

Public Sub deldata(ByVal tn As String)
Dim sql As String
sql = "delete" & Trim$(tn)
Set conn = New ADODB.Connection
conn.ConnectionString = "dsn=ks;uid=sa;pwd=;"
conn.Open
conn.Execute sql
If Trim(tn) = "oper" Then
sql = "insert oper values('1234','1234','系统管理员')"
conn.Execute sql
End If
conn.Close
End Sub
Public Sub endata(keyasc As Integer)
If keyasc = 13 Then
SendKeys "{tab}"
End If
End Sub

TOP

Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
txtsql = "select * from oper where 用户名='" & Trim$(Text1(0).Text) _
& "'" & " and 口令='" & 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, "信息提示"
mrc.Close
Unload Me
End If
Else
userlevel = Trim(mrc.Fields("级别"))
mrc.Close
Unload Me
main.Show
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
n = 0
End Sub



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

TOP

本功能由奇虎搜索实现

相关主题

标题 作者 最后发表
[站外] Flash模块---女子如花   [转帖] 游仙 2008-11-30
[站外] 库和模块的使用   [转帖] 一剑寒梅2 2008-11-30
[站外] 差异课堂的基本架构   [转帖] 思考者 2008-11-30
点击阅读更多关于的相关帖子  更多相关主题