Pour les Insert
la suite du code toujours avec un recordset
Code : Tout sélectionner
With $oRs
.Open("SELECT FROM matable", $oConn)
.AddNew
.Fields("unchamp").Value = "la nouvelle valeur ou une variable AutoIt"
.Update ; met à jour le RecorSet
.Close ; le ferme
EndWith
tu peux même modifier un champs dans la ligne en cours et faire le Update.
Une fonction dans mon projet qui met à jour la table Fichier en ajoutant ou en mettant un enregistrement à jour avec comme paramètre un tableau qui est une simple liste de fichier:
toujours avec le même objet Connexion, pour les constantes ADO:
Code : Tout sélectionner
Func Video_toADORS(ByRef $a)
Local $_oRS = ObjCreate("ADODB.Recordset")
$_oRS.Open("SELECT * FROM FICHIERS", $oConn, $adOpenStatic, $adLockOptimistic)
With $_oRS
For $i = 1 To $a[0]
If $a[$i] = "" Then ContinueLoop
Local $filter = "Full_Path='" & StringReplace($a[$i], "'", "''") & "'"
.Filter = $filter
If .RecordCount = 0 Then
.AddNew
.Fields("Full_Path" ).Value = $a[$i]
EndIf
Local $szDrive, $szDir, $szFName, $szExt
_PathSplit($a[$i], $szDrive, $szDir, $szFName, $szExt)
.Fields("File" ).Value = $szFName
.Fields("Taille" ).Value = FileGetSize($a[$i])
Next
.Update
.Close
EndWith
EndFunc ;==>Video_toADORS
► Afficher le texteConstantes ADO
Code : Tout sélectionner
#Region Constantes
Global Const $adoProvider = 'Microsoft.Jet.OLEDB.4.0'
Global Const $adPersistXML = 1
Global Const $adUseClient = 3
Global Const $adSchemaTables = 20
Global Const $adVarChar = 200
Global Const $adClipString = 2
Global Const $MaxCharacters = 255
;CursorTypeEnum Constants
Global Const $adOpenUnspecified = -1
Global Const $adOpenForwardOnly = 0
Global Const $adOpenKeyset = 1
Global Const $adOpenDynamic = 2
Global Const $adOpenStatic = 3
;LockTypeEnum Constants
Global Const $adLockUnspecified = -1
Global Const $adLockReadOnly = 1
Global Const $adLockPessimistic = 2
Global Const $adLockOptimistic = 3
Global Const $adLockBatchOptimistic = 4
;CommandTypeEnum Constants
Global Const $adCmdFile = 256
Global Const $adCmdStoredProc = 4
Global Const $adCmdTable = 2
Global Const $adCmdTableDirect = 512
Global Const $adCmdText = 1
Global Const $adCmdUnknown = 8
Global Const $adCmdUnspecified = -1
;EditModeEnum
Global Const $adEditNone = 0
Global Const $adEditInProgress = 1
Global Const $adEditAdd = 2
Global Const $adEditDelete = 4
;ExecuteOptionEnum Constants
Global Const $adAsyncFetch = 32
Global Const $adAsyncFetchNonBlocking = 64
;BookmarkEnum
Global Const $adBookmarkCurrent = 0
Global Const $adBookmarkFirst = 1
Global Const $adBookmarkLast = 2
;GetRowsOptionEnum
Global Const $adGetRowsRest = -1
;ObjectStateEnum
Global Const $adStateClosed = 0
Global Const $adStateOpen = 1
Global Const $adStateConnecting = 2
Global Const $adStateExecuting = 4
Global Const $adStateFetching = 8
#EndRegion Constantes