本文介紹了如何使用monotouch以編程方式在sqlite中創建數據庫和表?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
任何機構都可以幫助我,如何使用monotouch在sqlite中以編程方式創建簡單的數據庫和表并插入值,一步一步的過程.我是這項技術的新手.謝謝..
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..
推薦答案
如果您使用的是 sqlite-net(我強烈推薦)你可以簡單地調用:
If you're using sqlite-net (which I highly recommend) you can simply call:
public class Stock
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[MaxLength(8)]
public string Symbol { get; set; }
}
創建
var db = new SQLiteConnection("stocks.db");
db.CreateTable<Stock>();
插入
var s = db.Insert(new Stock() {
Symbol = symbol });
查詢
return db.Query("select * from Valuation where StockId = ?", stock.Id);
Query
return db.Query ("select * from Valuation where StockId = ?", stock.Id);
這篇關于如何使用monotouch以編程方式在sqlite中創建數據庫和表?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!