Analyze .SQL, .CSV and .XLS-files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TWVubm92ZHZlZW4=?=

    Analyze .SQL, .CSV and .XLS-files

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

  • Pavel Minaev

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

    On Jun 18, 4:30 pm, Mennovdveen
    <Mennovdv...@di scussions.micro soft.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.

    Comment

    Working...