|
Public Function qry_emp_subsidy(my_year As Integer, my_month As Integer, my_emp_sn As String) As Currency
Dim com As New ADODB.Command
Dim prm As New ADODB.Parameter
With com
.CommandText = "usp_qry_emp_subsidy"
.CommandType = adCmdStoredProc
.ActiveConnection = CurrentProject.Connection
End With
Set prm = com.CreateParameter(, adSmallInt, adParamInput, , my_year)
com.Parameters.Append prm
Set prm = Nothing
Set prm = com.CreateParameter(, adTinyInt, adParamInput, , my_month)
com.Parameters.Append prm
Set prm = Nothing
Set prm = com.CreateParameter(, adChar, adParamInput, 4, my_emp_sn)
com.Parameters.Append prm
Set prm = Nothing
Set prm = com.CreateParameter(, adCurrency, adParamOutput)
com.Parameters.Append prm
Set prm = Nothing
com.Execute
If IsNull(com.Parameters(3)) Then
qry_emp_subsidy = 0
Else
qry_emp_subsidy = com.Parameters(3)
End If
com.Parameters.Refresh '刷新參數
If com.Parameters(0) <> 0 Then '取得並判斷返回值
MsgBox "error !", vbOKOnly, "err"
Exit Function
End If
Set com = Nothing
End Function
|
|