| 12
 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
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 
 | VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5490
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9930
   LinkTopic       =   "Form1"
   ScaleHeight     =   5490
   ScaleWidth      =   9930
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   615
      Left            =   7680
      TabIndex        =   2
      Top             =   2280
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   7560
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   960
      Width           =   2055
   End
   Begin VB.ListBox List1 
      Height          =   450
      Left            =   1440
      TabIndex        =   0
      Top             =   1080
      Width           =   5055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cmd As New ADODB.Command
Dim connect As ADODB.Connection
Dim rec As ADODB.Recordset
 
 
Private Sub Form_Load()
 
    Set connect = New ADODB.Connection
    Set rec = New ADODB.Recordset
    ''Definition du pilote de connexion
    connect.Provider = "Microsoft.Jet.OLEDB.4.0"
    ''Definition de la chaine de connexion
    connect.ConnectionString = "C:\Documents and Settings\est\Bureau\nouv.mdb"
    ''Ouverture de la base de données
    connect.Open
    ''Exécution de la requete
    rec.CursorLocation = adUseClient
 
 
 
    cmd.CommandText = "Update mehdi SET code=Replace(code, 'OS', 'NIV') WHERE code LIKE 'OS%'"
'cmd.CommandText = "Update mehdi SET code='" & Replace(code, "OS", "NIV") & "' WHERE code LIKE 'OS%'"
'cmd.CommandText = "Update mehdi SET code='NIV1' + SubString(code, 3, 255)WHERE code LIKE 'OS%'"
    cmd.ActiveConnection = connect
    Set rec = cmd.Execute
 
    connect.Close
End Sub | 
Partager