Bonjour à toutes et à tous,
Je commence dans C#. Je suis en train d'écrire des petits programmes.
Ci-dessous, une fonction qui fait un COUNT(*).
Mon problème c'est dans la méthode ".GetIntXX(0)".
Quand j'utilise .GetInt32(0) avec un Int32, Cela marche (380 000 lignes).
Quand j'utilise .GetInt64(0) avec un Int64 ou un Long, cela ne marche pas (le count est le même: 380 000).
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 public Int32 getNbProduits() { Int32 llNbrProduits = 0; SqlCeDataReader myReader = null; SqlCeCommand cmd = new SqlCeCommand(); reconnecte2(); cmd.Connection = _conn2; cmd.CommandText = "SELECT COUNT(*) FROM BPRODUIT"; try { myReader = cmd.ExecuteReader(); if (myReader.Read()) { llNbrProduits = myReader.GetInt32(0); } myReader.Close(); } ... }
Partager