ADO - Connessione Oracle




vedi StipendiLexmark

'*********************************************************

' confronta col log Errori e la tabella orache importata *

' connessione ORACLE *

'*********************************************************

Dim ConnOracle As adodb.Connection
Dim Rs As adodb.Recordset

On Error GoTo Errore

Dim OkEntro As Boolean
Dim strCnn As String

strCnn = "Provider=MSDAORA.1;Password=inail_stip;User ID=inail_stip;Data Source=SERVENTEPRODUZIONE;Persist Security Info=False"
Set ConnOracle = New adodb.Connection
ConnOracle.Open strCnn


Set Rs = New adodb.Recordset
Rs.Open "Select Matricola, Tipo_Doc from Inail_stip where mese_retr = '06' and anno_retr = '2008'", ConnOracle, adOpenStatic, adLockOptimistic

If Dir(Dir2.Path & "\Errore.log") <> "" Then
ProgressBar1.Min = 0
ProgressBar1.Max = FileLen(Dir2.Path & "\Errore.log")
ProgressBar1.Value = 0


Open Dir2.Path & "\Errore.log" For Input As #3
Open Dir2.Path & "\Errore.txt" For Output As #5 '
Print #5, "*********************************"
Print #5, "matricole assenti sul database"
Print #5, "*********************************"

Line Input #3, Stringa
ritorna:
Me.Text1.Text = "0"


Do While Not EOF(3)
DoEvents
Me.Text1.Text = Me.Text1.Text + 1
If ProgressBar1.Value + Len(Stringa) <= ProgressBar1.Max Then
ProgressBar1.Value = ProgressBar1.Value + Len(Stringa)
End If

Line Input #3, Stringa

If Len(Stringa) < 71 Then
GoTo ritorna
End If

' Rs.MoveFirst

If Mid(Stringa, 1, 1) = "R" Then
Rs.Filter = ""
Rs.Filter = "Matricola = " & Mid(Stringa, 17, 6) & " AND Tipo_Doc = 'ALL'"
' Rs.Find "(((ConfrontaPDF_Oracle.matricola)='" & Mid(Stringa, 17, 6) & "') AND ((ConfrontaPDF_Oracle.documento)='ALL'))"

Else ' "C"
Rs.Filter = ""
Rs.Filter = "Matricola = '" & Mid(Stringa, 16, 6) & "' AND Tipo_Doc = 'CED'"
End If
If Rs.EOF Then
Print #5, Stringa
OkEntro = True
End If

Loop
Close #3


If OkEntro = False Then
Print #5, "SONO STATI INSERITI TUTTI I DOCUMENTI"

End If
Close #5


Shell "Notepad.exe " & Dir2.Path & "\Errore.txt", vbMaximizedFocus




End If
ConnOracle.Close

Exit Sub

Errore:
MsgBox Err.Description, vbCritical, "KO!"

Resume Next










( adoconnessioneoracle.html )- by Paolo Puglisi - Modifica del 17/12/2023