R3Tech
R3Tech

Reputation: 801

Load .sql file to a DataSet or DataTable with C#

Is it possible to load a .sql file into a DataSet or DataTable without executing it on a SQL Server database and then read the values from the database?

I know the way to load the .sql file into SQL Server and then read out the values, but is there a way to skip this because I don't have the option to create a SQL Server on the PC at the moment.

The .sql file has a CREATE TABLE statement and a INSERT INTO query with some data

Greetz.

Upvotes: 0

Views: 628

Answers (1)

Michal Ciechan
Michal Ciechan

Reputation: 13888

In-Memory SQSQLite or SQL Server CE maybe? Depends on whats in your SQL file, and if there are any SQL Server specific statements.

In that case it pretty much boils down to

  1. In-memory database (would be my preferred option)
  2. Parsing the file directly using a custom adapter. Maybe its a good idea for you to start an open source project. And once you come across hiccups to ask for help ;-)

Upvotes: 1

Related Questions