Analyze .SQL, .CSV and .XLS-files

  • Thread starter Thread starter Mennovdveen
  • Start date Start date
M

Mennovdveen

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!!!
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top