Re: Analyze .SQL, .CSV and .XLS-files



On Jun 18, 4:30 pm, Mennovdveen
<Mennovdv...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
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.
.



Relevant Pages

  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... But SQL does not have a pointer data type or the ... > being told to design a database. ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... a surrogate key should support the primary key. ... But SQL does not have a pointer data type or the ... > being told to design a database. ...
    (comp.databases.theory)
  • Re: dbdebunk Quote of Week comment
    ... But SQL does not have a pointer data type or the ... More and more programmers who have absolutely no database training are ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: Just say no to threads [Was: Software architecture]
    ... they knew there was going to be a database in the app. ... Now my colleague just spent a couple/three weeks designing an SQL ... Turns out they have a flat file of sample information, ...
    (comp.object)