1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Sub Volumetrie("Select * from ttrardc")
' Déclaration
Application.ScreenUpdating = False
Dim PrecServer As String
Dim CurrServer As String
Dim sql As String
Dim Login As String
Dim Password As String
Dim PathRequête As String
Dim MyWbResult As Workbook
Dim MyWsResult As Worksheet
Dim isConnect As Boolean
Dim rstSql As Recordset
' Initialisation
PrecServer = "ops$rdcexplo" & Format(shtVol.[PrecServer].Value, "ddmmyy")
CurrServer = Format(shtVol.[CurrServer].Value, "ddmmyy")
PathRequête = shtVol.[path].Value
Login = shtVol.Text_login.Value
Password = shtVol.Text_password.Value
sql = getRequetSQLFromFile(PathRequête, Requete)
' sql = Replace(sql, "ops$rdcexplo.", "")
' Partition courante
If InitConnection("RDCX06", Login, Password) Then
Set rstSql = ADOCnx.Execute(sql)
End If
' Partition Précedente
If InitConnection("RDCX08", Login, Password) Then
Set rstSql = ADOCnx.Execute("alter session set current_schema = ops$rdcexplo" & "310813")
Set rstSql = ADOCnx.Execute(sql)
End If
Set MyWsResult = ThisWorkbook.Worksheets("Test")
MyWsResult.Cells(1, 1).CopyFromRecordset rstSql
Set rstSql = Nothing
ADOCnx.Close
End Sub |
Partager