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..
-
Kishore, please take the time to read the FAQ - stackoverflow.com/faq. You will get more useful help from people if you obey the rules for asking good questions. Specifically, you should take the time to ACCEPT answers to questions which are helpful to you. It appears that you have never done this for any of the previous questions you have posted.Jason– Jason2011-10-31 13:04:35 +00:00Commented Oct 31, 2011 at 13:04
-
Ok,but i didnt get solution from the previous answers.so i didnt accept those.Sory for thatKiShOrE– KiShOrE2011-10-31 14:51:00 +00:00Commented Oct 31, 2011 at 14:51
Add a comment
|
1 Answer
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);
1 Comment
Guillermo Oramas R.
Hi Anuj, so you know I use this solution, and the first time I run it in my emulator it goes very well, then I comment the code for creating the table (so it doesn't create it again), and when I run the project again it says that there´s no table in the DB. Do you know why is this?, do I need to create the DB every time I run the project? Thanxs.