Toujours fichier excel

cs_Solution Messages postés 92 Date d'inscription lundi 4 avril 2005 Statut Membre Dernière intervention 7 août 2006 - 4 avril 2005 à 17:01
kuise Messages postés 9 Date d'inscription mercredi 2 avril 2003 Statut Membre Dernière intervention 18 décembre 2005 - 16 nov. 2005 à 12:38
bonjour,
j'ai essayer pour les fichiers excel voici ce que j'ai pu faire

string ConnectionString = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=D:\\ched\\fichiers marchants\\pixmania.csv;DefaultDir=c:\";



string CommandText = "select * from pixmania.csv";


OdbcConnection myConnection =
new OdbcConnection(ConnectionString);


OdbcCommand myCommand =
new OdbcCommand(CommandText, myConnection);


myConnection.Open();


DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection);


DataGrid1.DataBind();


myConnection.Close();

et l'erreur est:

ERROR [HY000] [Microsoft][ODBC Excel Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x5dc Thread 0x8ac DBC 0x439544 Excel'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed ERROR [HY000] [Microsoft][ODBC Excel Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x5dc Thread 0x8ac DBC 0x439544 Excel'. ERROR [HY000] [Microsoft][ODBC Excel Driver] External table is not in the expected format. ERROR [HY000] [Microsoft][ODBC Excel Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x5dc Thread 0x8ac DBC 0x439544 Excel'. ERROR [HY000] [Microsoft][ODBC Excel Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x5dc Thread 0x8ac DBC 0x439544 Excel'. ERROR [HY000] [Microsoft][ODBC Excel Driver] External table is not in the expected format.
<META content="Microsoft Visual Studio .NET 7.1" name=GENERATOR>
<META content=C# name=CODE_LANGUAGE>
<META content=JavaScript name=vs_defaultClientScript>
<META content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema>
pouvez voue m'aidez

Merci pour votre aide

1 réponse

kuise Messages postés 9 Date d'inscription mercredi 2 avril 2003 Statut Membre Dernière intervention 18 décembre 2005
16 nov. 2005 à 12:38
Salut,

Je pense que ma réponse arrive bien trop tard mais cela peut servir pour les prochaine personne cherchant une solution identique :


DataGrid1.DataSource = AdoHelper.CSVHelper.GetCVSFile(@"c:\inetpub\wwwroot\MonSite\RepertoireCSV","Fichier.csv");


DataGrid1.DataBind();

++

Steph
0
Rejoignez-nous