Demo App
To get you started with the DataTables libraries and Editor on your own server (or development machine), we provide a demo application that includes all of the Editor examples on this site, including their server-side scripts and the SQL for the backing database.
The demo app can be downloaded and then installed on your server or run locally. This guide will walk you through that process.
Download
To download the Editor .NET demo app, if you haven't already, open the Editor download page and download the .NET package.
When the download completes, unzip the Editor-NET-3.0.0-beta.1, ready for editing. Open the project in Visual Studio, or whatever your preferred editor is.
Examples SQL
With the project successfully opened in Visual Studio, we now need to load your database with the tables and data required for the Editor examples. The .NET libraries work with a number of different databases, each of which requires its own SQL. The following links contain the SQL needed for each of the supported databases:
Select the appropriate file for your database and then run the SQL contained within on your database access portal (SQL Server Management Studio, CLI, phpMyAdmin or pgAdmin3 for example). The demo SQL will create new tables and enter data into them. Note that they will overwrite any conflicting table names - installing the demo into a new database is recommended and also, as is good practice, ensure that you have backed up your database.
Database connection
The next step is to set up the database connection so the libraries can interact with the database server, reading and modified data as required. This is done through the Database class in the DataTables namespace, which is a database abstraction layer, so it can interface with any of the above database types.
In the demo app, you will see that in each controller a Database class instant is initialised:
var settings = Properties.Settings.Default;
using (var db = new Database(settings.DbType, settings.DbConnection))
{
...
}
The two properties allow the connection information to be set in a central location. To modify these properties, double click the Settings.settings file in the application Properties option (in Visual Studio's Solution Explorer).
There are two settings defined for the example application:
DbType- This defines the database type you are connecting to and can be one of:azure- Microsoft Azuremysql- MySQLpostgres- PostgreSQLsqlite- SQLitesqlserver- SQL Serversqlserverce- SQL Server CE (for local file databases)
DbConnection- This is the database connection string to connect to the SQL server. The exact format of the connection string depends upon the server being used, but typically it includes the server host name / address, user name and password. The Connection Strings web-site can be useful if you aren't sure of what connection string to use for your server.
Set these two values as required to establish a connection to your database.
Running the examples
That's all the set up that is needed to run the examples! To actually run them, now press F5 or select the Start debugging option from the Debug menu in Visual Studio.