By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,175 Members | 1,767 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,175 IT Pros & Developers. It's quick & easy.

Analyze .SQL, .CSV and .XLS-files

P: n/a
Goodday,

I'm stuck building a .NET-application.

The purpose of the application is checking for empty records in a
database-exportfile.
The user gives a 'csv, .xls or .sql file. The application analyses it, after
the user selected the table.

The problem is, i can't get the application to read the exportfile.
How can i program it to read the tables and how can i program it to search
the database and return back with the right records. Is this just plain SQL?
Thanks in advance!!!

Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Jun 18, 4:30*pm, Mennovdveen
<Mennovdv...@discussions.microsoft.comwrote:
Goodday,

I'm stuck building a .NET-application.

The purpose of the application is checking for empty records in a
database-exportfile.
The user gives a 'csv, .xls or .sql file. The application analyses it, after
the user selected the table.

The problem is, i can't get the application to read the exportfile.
How can i program it to read the tables and how can i program it to search
the database and return back with the right records. Is this just plain SQL?

Thanks in advance!!!
.csv is "comma-separated values". There are plenty of third-party .NET
libraries to parse that, a quick Google search will give you a lot of
hits. Here's one example: http://www.filehelpers.com/

.xls is, obviously, an Excel file. You might want to use VSTO (Visual
Studio Tools for Office) to extract data from it, but then your
application will require Excel to be installed.

.sql is, as the extension implies, a collection of SQL statements. In
general, there are many incompatible SQL dialects out there, and
without knowing which one is which, it can be impossible to parse it.
But if it only contains INSERTs, then there is hope. The most
straightforward (if not very efficient) way of handling such a file is
to create a temporary database (using e.g. SQL Server CE), read all
statements from the .sql file and execute it on the database, and then
read all data from the database as usual (SqlDataReader etc).
Otherwise, you'll need to write your own SQL parser.
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.