Efecan Şentürk
Efecan Şentürk

Reputation: 21

SQL commands on Dataset?

I've been developing a movie recommendation program similar to Netflix and have been using a database on my localhost.

The problem is I dont want to use my localhost, and want the app to work on other computers without a server setup. I couldn't find any free hosting sites that could host a database with the size of 1.24 GBs.

So I wanted to know if I could use C# Dataset(after importing my database into it) and still use my SQL commands to work on this Dataset? The examples I checked are always using the rows and coulmns instead of SQL commands.

sorry for bad English.

Upvotes: 1

Views: 135

Answers (2)

Ed Ryan
Ed Ryan

Reputation: 11

If you're looking for a portable database you can distribute with your application, instead of relying on a third-party database server, you might want to look at SQLite.

Basically, you would save the database into a ".db" file and read it from the application using an appropriate library, like Mono.Data.SQLite.

The website for this library contains examples of how you would load the database and execute SQL commands against it.

Upvotes: 1

user3879357
user3879357

Reputation: 11

SQL queries are required in any case; with or without DataSet. The difference between DataSet and DataReader is the following:

DataSet is set of tables and realtions among the tables. DataReader is an object, allowing you to read data from database. To use a DataSet you need to use DataAdapter/TableAdapter. DataAdapter/TableAdapter is an object with 4 SqlCommands (Delete, Insert, Select, Update). These commands are used to select values from database or to update the database upon the RowState in each record. Behind the scenes each command executes its own DataReader/DataWriter.

Using a DataReader will lead you to create your own entities. DataSet on the other side can be created from designer. Designer allows you to create tables, relations, contraints,... Drag and drop from Server Explorer might be another benefit. With DataAdpater you can create a typed DataSet upon the queries. If you're application requires import/export, you'll have to write this functionality on your own when using custom entities. With DataSet this ain't a problem, allowing you to import/export data into XML. It can also be bound to DataGridView or any other similar control. DataSet also supports one level of history, allowing you to revert to previous version of each row.

I also suggest reading this documentation:

http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx

Upvotes: 0

Related Questions