Knight Data Access Layer
Creating Databases VB.NET
Basic Tasks VB.NET > Creating Database Structure > Creating Databases VB.NET

Creating Empty Databases

 

Knight Data Access Layer has the ability to create databases for SQL Server, SqLite, MS Access, VistaDb, and MySql.  For file databases such as MS Access, Sqlite, and VistaDb, simply specify the path of the database.  Specify the database name for SQL Server and My SQL.  See also Connection String Tags

 

Dim provider As New SqLiteProvider()

Dim db As New DataHelper(provider)

Dim filePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestDatabase.db")

db.CreateDatabase(filePath)

 

Creating Databases and Synchronize All Tables

Alternatively, the Setup command can be used to create the database if it does not exist and add tables that do not exist and add columns that do not exist.

 

'Create the database if it does not exist (uses the database specified in the connection string)

'Create tables if they do not exist for a namespace

'Add columns that do not exist for corresponding classes

db.Setup("AcmeInc.Business.Entities")