devil_recycler
Messages postés170Date d'inscriptionvendredi 6 août 2004StatutMembreDernière intervention 8 février 2007
-
9 août 2004 à 15:29
cs_fabrice69
Messages postés1765Date d'inscriptionjeudi 12 octobre 2000StatutMembreDernière intervention11 décembre 2013
-
9 août 2004 à 23:34
je souhaiterai remplir une datagrid a partir d'un csv, ouvert avec excel. Ca marche mais y a des champs qu'il lit comme null alors qu'il contient bien une valeur !!!
si quelqu'un sait pourquoi......
merci
string ConnectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=c:";
OdbcConnection connection = new OdbcConnection(ConnectionString);
connection.Open();
OdbcCommand command = new OdbcCommand("Select * FROM Subscribers.csv", connection);
OdbcDataReader reader = command.ExecuteReader();
while (reader.Read())
{
// loop through every field
for (int x = 0; x < reader.FieldCount; x++)
{
// add code for puting fields into array....
Console.WriteLine(reader.GetDataTypeName(x) + " - " + reader.GetValue(x));
}
}