Sample: ScimoreDB Embedded in WinForms 1 - Get Started in 3 minutes
Using ScimoreDB is extremely easy. It takes less that 3 minutes to have a fully featured powerfull SQL server inside your application. Below is a a simple step by step list on how to use ScimoreDB Embedded 2.5 in an standard WinForm/Console application:
1) Download and install ScimoreDB MSI from http://www.scimore.com/downloads/
2) Inside your application, add a reference to Scimore.Data
3) For simplicity, add the following "using" statement
Add a using statement to top of your code files. In our case the Form1.cs file.
using Scimore.Data.ScimoreClient;
The ScimoreDB Embedded is now ready to be used in your program!
4) Sample code snippet show how easy it is to use
You now need to create your database. People usually start up the manager, and create an embedded database. But for the sake of demonstration it's here done using c# code. Note that at any point, while your program us running and is using your database - you can connect to the database with the manager, and do the things you use to do with a database manager.
The database is created as a sub-directory at the location of your program.
// Create handle to out of process embedded database instance
ScimoreEmbedded em = new ScimoreEmbedded();
// Create new database instance named WinForms1
em.Create("WinForms1");
em.Open("WinForms1");
// Connect to our embedded database using standard .NET provider
ScimoreConnection cn = em.CreateConnection();
// Create a database on our database instance.
ScimoreCommand cmd = new ScimoreCommand("create
database sampledatabase", cn);
cmd.ExecuteNonQuery();
// Create sample table, and insert sample row
cmd = new ScimoreCommand("use sampledatabase;
create table sampletable ([id] int not null, [text] varchar)", cn);
cmd.ExecuteNonQuery();
cmd = new ScimoreCommand(@"insert into sampletable
([id], [text]) values (1, 'sample text string');", cn);
cmd.ExecuteNonQuery();
// Clean up nicely. Close connection and shutdown embedded database
process
cn.Close();
em.Shutdown();
Accessing the database with ScimoreDB Manager.
It is possible to access the database using the ScimoreDB manager, simultaniously as you program is accessing the database.
First open the ScimoreDB manager. Then register our newly created database instance "WinForms1".
It is located as a directory under our binary. In our case the "bin/debug" folder.
Your can now work with the database from the manager.