I'm attempting to write a connection string for a .txt file with C#.
I keep getting the error saying that my file path is invalid.
string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\Josh\Documents\Test.txt;Extended Properties=""text;HDR=YES;FMT=Delimited""";
The file path shouldn't be wrong. So, I'm thinking it's some other problem. Perhaps I'm missing something with the file path though.
Any suggestions would be great.
"C:\Users\Josh\Documents\Test.txt"(and remove the wrongExtended Properties=""text- thetextdoesn't belong there).textdoes not belong there at all. It should either be inside the""or removed entirely. ConnectionStrings is a site you should bookmark if you're going to do much with ADO."text;HDR=Yes;FMT=Fixed"inside the quotes; your original one had""text;HDR=Yes;FMT=Fixed, with the text following (after) the quotes. Can't you see the difference? If not, copy and paste each of them into a text editor, each on it's own line, and compare them character by character. The new one should be correct.