How to create database and table in sqlite program

2019-08-17 07:00发布

Can any body help me about, how to create simple database and tables programatically and insert values ,step by step procedure in sqlite using monotouch.I am new to this technology . Thank you..

1条回答
Deceive 欺骗
2楼-- · 2019-08-17 07:55

If you're using sqlite-net (which I highly recommend) you can simply call:

Model

public class Stock
{
        [PrimaryKey, AutoIncrement]
        public int Id { get; set; }
        [MaxLength(8)]
        public string Symbol { get; set; }
}

Create

var db = new SQLiteConnection("stocks.db");
db.CreateTable<Stock>();

Insert

var s = db.Insert(new Stock() {
Symbol = symbol });

Query

return db.Query ("select * from Valuation where StockId = ?", stock.Id);

查看更多
登录 后发表回答