using VistaDB;
using VistaDB.DDA;
private void CreateTableDdaDemo(string filename)
{
// Open a DDA Connection
using (IVistaDBDDA DDAObj = VistaDBEngine.Connections.OpenDDA())
// Create a new database (or use OpenDatabase to open an existing one)
using (IVistaDBDatabase db1 = DDAObj.CreateDatabase(filename, true, null, 2, 0, false))
{
// Define a new table schema and add columns and an identity to it
using (IVistaDBTableSchema table1schema = db1.NewTable("TestTable1"))
{
table1schema.AddColumn("ID", VistaDBType.Int);
table1schema.DefineColumnAttributes("ID", false, false, false, false, null, null);
table1schema.DefineIdentity("ID", "1", "1");
table1schema.AddColumn("COLINT", VistaDBType.Int);
table1schema.DefineColumnAttributes("COLINT", false, false, false, false, null, null);
//Actually create the table in the database from the definition we created
using (IVistaDBTable table1 = db1.CreateTable(table1schema, false, false))
{
// Add indexes
table1.CreateIndex("Primary", "ID", true, true);
table1.CreateIndex("idxInt", "COLINT", false, false);
}
}
}
}