LaserdogLezly
asked on
Save csv File to Desktop
I have a .NET web app that queries a mySQL DB. I want to send the results to an Excel file/datatable on the users desktop.
Everything seems to work fine, but the file isn't there. But when I run the app a 2nd time, I get an error that the file exists, but there is no file.
Here's my file path & SQL query.
The following SQL query works fine & the file is there.
Everything seems to work fine, but the file isn't there. But when I run the app a 2nd time, I get an error that the file exists, but there is no file.
Here's my file path & SQL query.
string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),
"dataTable.csv");
string sql3 = "SELECT * FROM table_173 " +
" INTO OUTFILE '" + fileName + "' " +
" FIELDS TERMINATED BY ',' " +
" ENCLOSED BY '\"' " +
" LINES TERMINATED BY '\n'; ";
The following SQL query works fine & the file is there.
string sql2 = "SELECT * FROM table_173 " +
" INTO OUTFILE 'C:/LH/dataTable.csv' " +
" FIELDS TERMINATED BY ',' " +
" ENCLOSED BY '\"' " +
" LINES TERMINATED BY '\n'; ";
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
which desktop?
ASKER
I saved an HTML file to my desktop.
is this the same machine that hosts the web site?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Both responses were correct in that I was saving to a remote server with permissions.
ASKER
Open in new window
on edit: I just checked the remote server & there is no file there.