sous vb 2005
je voudrais savoir Comment modifier le contenu d'un enregistrement d'un base de données access 2003?
update matable set monchamp = value where clé = valeurclé
qu'est ce qui ne marche pas ds ce code?
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Dim n As Integer = Val(txtNumero.Text) Dim Savecommand As New OleDb.OleDbCommand Dim Connectionstring As String = _ "Provider=Microsoft.Jet.OLEDB.4.0; Data Source =" & _ Application.StartupPath & "\db.mdb" Dim newconnection As New OleDbConnection(Connectionstring) Savecommand.Connection = newconnection Savecommand.CommandType = CommandType.Text Savecommand.CommandText = "UPDATE TableA SET n° = '" & Trim(txtNuEleve.Text) & _ "'_ , classe = '" & Trim(txtClasse.Text) & "' , prenom = '" & Trim(txtPrenom.Text) & _ "' , nom = '" & Trim(txtNom.Text) & "' , note= '" & Trim(txtScore.Text) & "' WHERE numero ='n'" newconnection.Open() Savecommand.ExecuteNonQuery() newconnection.Close() messagebox.show("Enregisstrement suvegardé avec succès")
Partager