Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I have no idea why I am getting this error
Message
De
28/07/2011 08:49:19
 
 
À
28/07/2011 08:30:47
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01519444
Message ID:
01519445
Vues:
58
>Hi All
>
>I have code that looks like this to import a .csv file into a data reader:
>
>
>string query2 = "SELECT * from " + filename;
>string csvConString2 = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + processDirectory + ";Extensions=csv";
>OdbcConnection cn2 = new OdbcConnection(csvConString2);
>OdbcCommand stmtCmd2 = new OdbcCommand(query2, cn2);
>cn2.Open();
>OdbcDataReader rdr = stmtCmd2.ExecuteReader();
>
>
>query2 contains the following:
>
>SELECT * from \\hcsfile\company\Applications\Brightree\NightlyDataDownload\ManualProcessingFolder\Recommended_For_Collection_Emphasis_07-28-11.csv
>
>I get the following error on the ExecuteReader method:
>
>ERROR [42000] [Microsoft][ODBC Text Driver] Syntax error in FROM clause.
>
>Now, the goofy thing is that the same code works flawlessly in other places. (No - this is not my code! I would have done this using SSIS.) So what gives here?

One obvious question : what is the content of 'filename' ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform