| Simple utility to SELECT records and save them as a CSV file I just had a client ask for a one off extraction of data from an application which used MSDE as the backend. The query wasn't something I'd made available in the web interface to the application and there were no SQL client tools to get the data out. I didn't have the MSDE manager, and anyway, he really wanted the data in a parsable format such as CSV.
So I wrote the utility shown in the screenshot below;
1. Enter the server name and database name, and user credentials.
2. Click Test Database Connection.
3. Enter your SQL statement, and click on Execute Select Statement.
4. Check how many rows are returned in the status message.
5. Select a file to which the data should be saved ....
6. Save the data by clicking on Export to CSV.
OK, it's not pretty as it doesn't preview the data, but hey, it took less than an hour to write so I'm happy, and so is the client. I've included all the source code (download here) for the database stuff. The CSV formatting is in a compiled system library which I can't release as source, but the rest of the code is all there.
The real logic is in a separate class library so could be used from a web page just as easily as a Windows application. All you need is the .NET framework 1.1 installed on the client PC and they can just run the EXE as long as the two assemblies are in there with it.
 |
|
|