For years, help
Dim l_sqlClose As String
Dim l_adorsClose As ADODB. You
L_sqlClose="select cld01 close_date, cld02 close_time, cld05 open_date from cld_file where cld03='Y'" 'B2B schedule closed books
The Set l_adorsClose=exesql (" B2B ", l_sqlClose)
If Not l_adorsClose. EOF Then
l_CloseDate=l_adorsClose (" close_date ")
L_CloseTime=l_adorsClose (" close_time ")
L_OpenDate=l_adorsClose (" open_date ")
End the If
L_CurrentDate=Format (Now (), "YYYYMMDD")
L_CurrentTime=Format (Now (), "HHMMSS")
'if the current date after the date in the closed account, billing date, will exit the program (not run during a closed books)
If (l_CurrentDate=l_CloseDate And l_CurrentTime & gt;=l_CloseTime) Or (l_CurrentDate & gt; L_CloseDate And l_CurrentDate & lt; Then l_OpenDate)
The Exit Sub
End If
CodePudding user response:
Exesql (" B2B ", l_sqlClose). The return value is a ADODB you object?Can put the exesql (" B2B ", l_sqlClose) code labeled to look over
CodePudding user response:
The following is to manipulatethe database
The Public Function exesql (SYSID As String, ByVal sSQL As String) As the ADODB library you
'don't pass parameters system, is advantageous for the database connection:
'said MES MES database connection string;
'said SAP SAP database connection string;
'said B2B B2B database connection string;
'and return in the form of Reconderset object itself, facilitate database operations,
Dim cnn1 As New ADODB. Connection
Dim adors1 As New ADODB. You
Dim 'arry () As String
'the exception handling
On Error GoTo exesql_err
'use of Split function to produce each string array
'arry=Split (Trim $(sSQL))
'open database connection By different system category
The Select Case UCase $(Trim $(SYSID))
Case "B2B"
Cnn1. Open g_b2b
Case "SAP"
Cnn1. Open g_sap
Case "MES
"Cnn1. Open g_mes
Case "B2BDS1
"Cnn1. Open g_b2bds1
End the Select
'judgment of SQL statement execution belong to that kind of action
If InStr (INSERT, DELETE, UPDATE, UCase $(' arry (0))) Then
Cnn1. Execute sSQL
The Else
With adors1
. CursorLocation=adUseClientBatch
The CursorType=adOpenKeyset
. LockType=adLockOptimistic
. Open sSQL, cnn1
'Set the ActiveConnection=Nothing
End With
The Set exesql=adors1
End the If
Exesql_exit:
The Set adors1=Nothing
'cnn1. Close
The Set cnn1=Nothing
The Exit Function
Exesql_err:
Resume exesql_exit
'MsgBox Err. The Description
End the Function
CodePudding user response:
This code others run would I run normally there is an error I which configuration problemCodePudding user response:
The Set adors1=NothingThis sentence you already set object for nothing, which will return you want to you
CodePudding user response:
That how to make the main I just took over this are written on others is not too clear how change can you elaborate on thatCodePudding user response:
Exesql_exit:The Set adors1=Nothing
'cnn1. Close
The Set cnn1=Nothing
Change
Exesql_exit:
'Set adors1=Nothing
'cnn1. Close
'Set cnn1=Nothing
Have a try
CodePudding user response:
Is a v6 or vb.net: excuse me, do you use?