salut
ma tache consiste à réaliser des modification sur une base de donnée sql server à partir de vb.net 2005
j'ai bien réussie la connexion à la base et je suis bloquée sur l'ajout d'un enregistement à une table intitulée "Salle"en fait j'exécute ce code
l'erreur suivante m'appait:
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ObjetDataRow1 As DataRow Dim ObjetDataAdapter1 As OdbcDataAdapter Dim ObjetCommandBuilder1 As OdbcCommandBuilder Dim ObjetDataTable1 As DataTable Dim ObjetDataSet1 As New DataSet() Dim ObjetCommand1 As OdbcCommand ObjetCommand1 = New OdbcCommand() ObjetDataAdapter1 =New OdbcDataAdapter(ObjetCommand1) ObjetCommand1.Connection() = cn ObjetDataAdapter1.Fill(ObjetDataSet1, "Ville") ObjetDataTable1 = ObjetDataSet1.Tables("Ville") ObjetDataRow1 = ObjetDataSet1.Tables("Ville").NewRow() ObjetDataRow1("IDVille") = Me.id.Text ObjetDataRow1("NomVille") = Me.nomville.Text ObjetDataRow1("CodeVille") = Me.codeville.Text ObjetDataSet1.Tables("Ville").Rows.Add(ObjetDataRow1) 'Pour modifier les valeurs changées dans le DataAdapter ObjetCommandBuilder1 = New OdbcCommandBuilder(ObjetDataAdapter1) 'Mise à jour ObjetDataAdapter1.Update(ObjetDataSet1, "Ville") 'On vide le DataSet et on le 'recharge' de nouveau. ObjetDataSet1.Clear() ObjetDataAdapter1.Fill(ObjetDataSet1, "Ville") ObjetDataTable1 = ObjetDataSet1.Tables("Ville") End
j'ai besoin d'aide, merciExecuteReader : la propriété CommandText n'a pas été initialisée
Partager