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
|
Dim Cn As ADODB.Connection
Dim CP As ADODB.Command
Dim Rs As ADODB.RecordSet
Dim connectionString As String
Dim SQLQuery As String
'Connexion au serveur Oracle
connectionString = "XXXXXXXXXXXXXXXXXXXXXXXXX"
Set Cn = New ADODB.Connection
Set CP = New ADODB.Command
Set Rs = New ADODB.RecordSet
With Cn
.connectionString = connectionString
.CursorLocation = adUseClient
.Open
End With
With CP
.ActiveConnection = Cn
SQLQuery = "Insert into FIELDS(ID_FIELD, TYPE_FIELD, NAME_FIELD) VALUES ('221', 'No', 'TEST')"
.CommandType = adCmdText
.CommandText = SQLQuery
.Execute
End With
Debug.Print CP.CommandText
' Close ADO objects
Cn.Close
Set Cn = Nothing
Set Rs = Nothing
Set CP = Nothing |
Partager