代码A
Dim RST As New ADODB.Recordset, CNN As New ADODB.Connection
Set CNN = CurrentProject.Connection
RST.Open "SELECT * FROM Sb_员工基本资料 WHERE 姓名='" & "陈芬芬" & "' ", CNN, adOpenStatic, adLockPessimistic
RST!密码 = RC4("ABC")
RST.Update
RST.Close
Set RST = Nothing
END SUB
代码B
Sub AddPass2()
DoCmd.RunSQL ("exec Tb_更改密码 " & "'陈芬芬', '" & RC4("ABC") & "'")
End Sub
'存储过程 Tb_更改密码
UPDATE dbo.Sb_员工基本资料
SET 密码效期 = GETDATE() + 30, 密码 = @新密码
WHERE (姓名 = @姓名)
Dim s(0 To 255) As Byte, K(0 To 255) As Byte, I As Long
Dim j As Long, temp As Byte, Y As Byte, t As Long, X As Long
Dim Outp As String
For I = 0 To 255
s(I) = I
Next
j = 1
For I = 0 To 255
If j > Len(conKey) Then j = 1
K(I) = Asc(Mid(conKey, j, 1))
j = j + 1
Next I
j = 0
For I = 0 To 255
j = (j + s(I) + K(I)) Mod 256
temp = s(I)
s(I) = s(j)
s(j) = temp
Next I
I = 0
j = 0
For X = 1 To Len(strInp)
I = (I + 1) Mod 256
j = (j + s(I)) Mod 256
temp = s(I)
s(I) = s(j)
s(j) = temp
t = (s(I) + (s(j) Mod 256)) Mod 256
Y = s(t)
Outp = Outp & ChrW(AscW(Mid(strInp, X, 1)) Xor Y)
Next
RC4 = Outp
End Function
adp 代码如下:
----------------------------------------
Public Function DoProcedure()
Dim cmdByRoyalty As ADODB.Command
Dim prmByRoyalty As ADODB.Parameter
Dim rstByRoyalty As ADODB.Recordset
Dim intRoyalty As String
Set cmdByRoyalty = New ADODB.Command
cmdByRoyalty.CommandText = "存储过程名"
cmdByRoyalty.CommandType = adCmdStoredProc
intRoyalty = Trim(InputBox("输入参数:"))
'你可以直接写参数,不用调用 input
Set prmByRoyalty = cmdByRoyalty.CreateParameter("aab", adChar, adParamInput, 255)
cmdByRoyalty.Parameters.Append prmByRoyalty
prmByRoyalty.value = intRoyalty
Set cmdByRoyalty.ActiveConnection = CurrentProject.Connection
Set rstByRoyalty = cmdByRoyalty.Execute
End Function