Bonjour tout le monde
Je veux tester un datareader s'il est vide (ne contient aucune ligne)
j'ai les lignes suivantes ..... mais ca ne fonctionne pas tjs
ca ne fonctionne pas si la table est vide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Dim Cmd As New SqlCommand("Select Max( " & champ & ") From " & table, Conn) Dim DR As SqlDataReader = Cmd.ExecuteReader() IncParAnnee = "" If DR.HasRows() Then If DR.Read Then IncParAnnee = Format(DR.GetValue(0) + 1, "0000").ToString Else IncParAnnee = "0001" End If DR.Close()
Partager