Bonjour,

J'ai une classe d'accès aux données qui me sert en parti à remplir un DataSet via un DataReader et Load, comme ceci:
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
   Public Sub GetDataSet(ByVal dataSet As DataSet, ByVal tableName As String, ByVal commandText As String)
 
        Dim objConnection As DbConnection
        objConnection = Nothing
        Dim objDbReader As DbDataReader
        objDbReader = Nothing
 
        Try
 
            objConnection = GetConnection()
 
            Dim command As DbCommand
            command = CreateDbCommand(commandText, objConnection, CommandType.Text)
 
            objConnection.Open()
 
            objDbReader = command.ExecuteReader(CommandBehavior.CloseConnection)
 
            dataSet.Load(objDbReader, LoadOption.PreserveChanges, tableName)
 
        Finally
            If objConnection.State <> System.Data.ConnectionState.Closed Then
                objConnection.Close()
            End If
 
        End Try
 
    End Sub
Mon soucis:
Dans ma table j'ai une colonne ID en autonuméro, et lorsque je charge la table dans un DataGridView si j'ajoute une ligne la colonne ID ne suit pas la numérotation...

Comment faire ?

Merci pour le coup de main

Gwendal