/*Creating tables*/ static public void CreateUserTable() { if (SQConnection != null) { SQConnection.CreateTable <User>(); } }
public void GetConnection() { SQLite.Net.SQLiteConnection db = new SQLite.Net.SQLiteConnection(new SQLitePlatformIOS(), GetPath()); db.DropTable <InputDataTable>(); db.CreateTable <InputDataTable>(); db.CreateTable <FlightDataTable>(); }
public static void CreateDatabase(String _DatabasePath) { if (!CheckFileExists(_DatabasePath).Result) { using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), _DatabasePath)) { conn.CreateTable <ExpenseReport>(); conn.CreateTable <Expense>(); } } }
public DataAccess() { var config = DependencyService.Get <IConfig>(); connection = new SQLite.Net.SQLiteConnection(config.Platform, System.IO.Path.Combine(config.DirectoryDB, "Soccer.db3")); connection.CreateTable <Parameter>(); connection.CreateTable <Team>(); connection.CreateTable <User>(); connection.CreateTable <UserType>(); }
/*Creating table*/ static public void CreateAlcoholTable() { if (SQConnectionAlcohol != null) { SQConnectionAlcohol.CreateTable <Alcohol>(); } }
private static void CreateDatabase() { using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), _sqlpath)) { conn.CreateTable <PushMessageModel>(); } }
public ClienteRepository() { var config = DependencyService.Get <IConfig>(); _conexao = new SQLite.Net.SQLiteConnection(config.Plataforma, System.IO.Path.Combine(config.DiretorioDB, "banco.db3")); _conexao.CreateTable <Cliente>(); }
/*Creating table*/ static public void CreateProductTable() { if (SQConnectionProduct != null) { SQConnectionProduct.CreateTable <Product>(); } }
public void Results() { conn.CreateTable <Appointments>(); var query = conn.Table <Appointments>(); ApptList1.ItemsSource = query.ToList(); ApptList.ItemsSource = query.ToList(); conn.CreateTable <Accounts>(); var accupdate = conn.Table <Accounts>(); AccountSelct.ItemsSource = accupdate.ToList(); }
public Item() { using (var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path)) { db.CreateTable <Item>(); } }
public SalesByDay() { using (var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path)) { db.CreateTable <SalesByDay>(); } }
public static void CreateDatabase() { var sqlpath = System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Contactdb.sqlite"); using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), sqlpath)) { conn.CreateTable <Contact>(); } }
private static void CreateDatabase() { try { string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); System.IO.Directory.CreateDirectory(folderPath); string databaseFilePath = System.IO.Path.Combine(folderPath, "FinancialProfile.db"); using (var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(), databaseFilePath)) { db.CreateTable <FinancialProfileDomain>(); if (db.Table <FinancialProfileDomain>().Count() == 0) { var FinancialProfile = new FinancialProfileDomain() { Question = "When is your birthday?", DataType = "DateTime" }; db.Insert(FinancialProfile); var question = db.Get <FinancialProfileDomain>(1); FinancialProfile = new FinancialProfileDomain() { Question = "What is your net worth?", DataType = "Int" }; db.Insert(FinancialProfile); FinancialProfile = new FinancialProfileDomain() { Question = "How much do you make each month after taxes including 1099, w2, 401k, and ira contributions?", DataType = "Int" }; db.Insert(FinancialProfile); FinancialProfile = new FinancialProfileDomain() { Question = "How much do you spend each month on your house?", DataType = "Int" }; db.Insert(FinancialProfile); FinancialProfile = new FinancialProfileDomain() { Question = "How much do you spend each month on your car?", DataType = "Int" }; db.Insert(FinancialProfile); FinancialProfile = new FinancialProfileDomain() { Question = "How much do you spend each month on everything else?", DataType = "Int" }; db.Insert(FinancialProfile); } } } catch (SQLiteException ex) { var t = ex; } }
public AcessoDados() { var config = DependencyService.Get <IConfig>(); _connection = new SQLiteConnection(config.Plataforma, System.IO.Path.Combine(config.DiretorioDB, "bancodados.db3")); _connection.CreateTable <Contato>(); }
public NewGame() { this.InitializeComponent(); path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite"); conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path); conn.CreateTable<Game>(); var add = conn.Insert(game); Debug.WriteLine(path); }
public Customer() { //Every time a customer is created if the table is not found, it is created. PayedDebt = 0; PayedDebtInfo = ""; using (var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path)) { db.CreateTable <Customer>(); } }
/// <summary> /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, /// 已执行,逻辑上等同于 main() 或 WinMain()。 /// </summary> public App() { conn = new SQLiteConnection(new SQLitePlatformWinRT(), path); //datebase建表 conn.CreateTable <Models.Member>(); menu = new Models.Menu(); ViewModel = new MemberViewModel(); SongList = new SongViewModels(); this.InitializeComponent(); this.Suspending += OnSuspending; }
public NewGame() { this.InitializeComponent(); path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite"); conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path); conn.CreateTable <Game>(); var add = conn.Insert(game); Debug.WriteLine(path); }
public MainPage() { this.InitializeComponent(); /*string path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,"db.sqlite"); * // string path = "ms-appdata:///local/db1.sqlite"; * connect = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path); * connect.CreateTable<Page>();*/ path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite"); connect = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path); connect.CreateTable <Page>(); }
public DB(string dbpath) { DB_PATH = dbpath; Debug.WriteLine("Init CLass DB"); if (!File.Exists(this.DB_PATH)) { Debug.WriteLine("Creating Database"); using (SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), this.DB_PATH)) { conn.CreateTable <Mobile>(); } } }
public static string DoSomeDataAccess() { Console.WriteLine("Creating database, if it doesn't already exist"); SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); string dbPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.Personal), "ormdemo.db3"); var db = new SQLite.Net.SQLiteConnection(plat, dbPath); db.CreateTable <Stock>(); if (db.Table <Stock>().Count() == 0) { // only insert the data if it doesn't already exist var newStock = new Stock(); newStock.Symbol = "AAPL"; db.Insert(newStock); newStock = new Stock(); newStock.Symbol = "GOOG"; db.Insert(newStock); newStock = new Stock(); newStock.Symbol = "MSFT"; db.Insert(newStock); } Console.WriteLine("Reading data"); var table = db.Table <Stock>(); string data = string.Empty; foreach (var s in table) { Console.WriteLine(s.Id + " " + s.Symbol); data += s.Id + " " + s.Symbol + " :: "; } return(data); }
void Setup() { _connection.CreateTable <Contact> (); _connection.DropTable <Quote> (); _connection.CreateTable <Quote> (); }
SQLite.Net.SQLiteConnection conn; //data connection /// <summary> /// Creates the database. /// </summary> public int createDatabase() { //create database local file name "HD_db.sqlite.sqlite" path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "HD_db.sqlite"); if (!File.Exists(path)) { //create database conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path); //Thêm bảng conn.CreateTable<Model_CHI_TIET_VAY_CHOVAY>(); conn.CreateTable<Model_GHI_CHEP>(); conn.CreateTable<Model_GUI_TIET_KIEM>(); conn.CreateTable<Model_HANG_MUC_CHI>(); conn.CreateTable<Model_HANG_MUC_CHI_CHA>(); conn.CreateTable<Model_HANG_MUC_THU>(); conn.CreateTable<Model_HANG_MUC_THU_CHA>(); conn.CreateTable<Model_LOAI_TAI_KHOAN>(); conn.CreateTable<Model_LOAI_TIEN>(); conn.CreateTable<Model_TAI_KHOAN>(); conn.CreateTable<Model_THIET_LAP>(); conn.CreateTable<Model_USERS>(); conn.CreateTable<Model_VAY_NGAN_HANG>(); //Thêm record try { EncryptPassword pass = new EncryptPassword(); conn.Insert(new Model_USERS() { Email = "*****@*****.**", FirstName = "Heo Đất", LastName = "Admin", Password = pass.encrypt("admin"), Type = "Admin", Status = true }); Debug.WriteLine("[QLTC] đã thêm admin"); } catch (Exception ex) { Debug.WriteLine("[QLTC] " + ex.Message); } try { var listHangMucChiCha = new List<Model_HANG_MUC_CHI_CHA>() { new Model_HANG_MUC_CHI_CHA() {TenHangMucChiCha= "Trang phục"}, new Model_HANG_MUC_CHI_CHA() {TenHangMucChiCha="Ăn uống" } }; foreach (var item in listHangMucChiCha) { conn.Insert(item); } var listHangMucChi = new List<Model_HANG_MUC_CHI>() { new Model_HANG_MUC_CHI() {IdHangMucChi=0, IdHangMucChiCha=1,TenHangMucChi="Quần áo",ChinhSuaHangMucChi=false,GhiChuHangMucChi="Mua sắm quần áo" }, new Model_HANG_MUC_CHI() {IdHangMucChi=1, IdHangMucChiCha=1,TenHangMucChi="Giầy dép",ChinhSuaHangMucChi=false,GhiChuHangMucChi="Mua sắm giầy dép" }, new Model_HANG_MUC_CHI() {IdHangMucChi=2, IdHangMucChiCha=1,TenHangMucChi="Khác",ChinhSuaHangMucChi=false,GhiChuHangMucChi="Mua sắm" }, new Model_HANG_MUC_CHI() {IdHangMucChi=3, IdHangMucChiCha=2,TenHangMucChi="Đi chợ/Siêu thị",ChinhSuaHangMucChi=false,GhiChuHangMucChi="Đi chợ, siêu thị" }, new Model_HANG_MUC_CHI() {IdHangMucChi=4, IdHangMucChiCha=2,TenHangMucChi="Ăn tiệm",ChinhSuaHangMucChi=false,GhiChuHangMucChi="Ăn tiệm" } }; foreach (var item in listHangMucChi) { conn.Insert(item); } } catch (Exception ex) { Debug.WriteLine("[QLTC] " + ex.Message); } } else // if file exist { conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path); } return 1; }