This project is read-only.

How to create Database

Jan 29, 2009 at 10:29 AM
Please, you have time explain to me how to make the database. Honestly, I try to learn myself. So I do not know how to make database using SharpDB
Jan 30, 2009 at 1:43 PM
Edited Jan 30, 2009 at 1:43 PM
Sure,

To create a new database, you need to do the following:
// Create a new Database. 
SharpDB.Database db = new SharpDB.Database(@"Path\to\your\database.db"); 

// Create a new Table.
string newTableName = "NewTableName";
db.CreateTable(newTableName);

// Add Columns to the Table.
db.AddColumn(newTableName, "NewColumn1", ColumnType.INT); 
db.AddColumn(newTableName, "NewColumn2", ColumnType.STRING);

// Adding items to the table.
ArrayList info = new ArrayList();
info.Add(0);
info.Add("Some String");

// Insert row. 
db.Insert(newTableName, info); 

//Commit Changes.
db.Commit();

- Jon
Jul 25, 2009 at 11:34 AM

I think it is good if you also include one  example  how to create database in your project. Honestly, Im new bee so still  confuse sometimes.Thanks

Jul 29, 2009 at 1:09 PM
cintakumara wrote:

I think it is good if you also include one  example  how to create database in your project. Honestly, Im new bee so still  confuse sometimes.Thanks

Have a look at this piece of source code (Jonathan.SharpDB.TextImporter):

http://jonathan.codeplex.com/SourceControl/changeset/view/10442#238011

It is how I created most of the databases used.

- Jon

Jul 30, 2009 at 10:20 AM

Thank you so much, I just see it, hoping I can get some idea how to creat the database. Wish you very nice day.