SlideShare a Scribd company logo
1 of 18
http://shinichiaoyagi.blogspot.jp/
http://www.sqlite.org/
class Person {
                               [PrimaryKey, AutoIncrement]
                               public int Id { get; set; }

                               [MaxLength(20)]
                               public string Name { get; set; }
                        }




using (var con = new SQLiteConnection(
       Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
       "AdressBook.db")))
{
       con.CreateTable<Person>();
       con.Insert(new Person() { Name = "メトロ太郎" });
}
var persons = con.Query<Person>("select * from Person where Id = 1");




class Result
{
       public string Name { get; set; }
}

var names = con.Query<Result>("select Name from Person where Id = 1");
var person = con.Table<Person>().Where(x => x.Id == 1).First();
con.Execute("update Person set Name='WindowsRT' where Id=1");




var person = con.Table<Person>().Where(x => x.Id == 1).First();
person.Name = "Metro";
con.Update(person);
var con = new SQLiteAsyncConnection(
       Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
       "AdressBook.db"));
await con.CreateTableAsync<Person>();
await con.InsertAsync(new Person() { Name = "メトロ太郎" });

var person = await con.Table<Person>().Where(x => x.Id == 1).FirstAsync();
person.Name = "Metro";
await con.UpdateAsync(person);

await con.ExecuteAsync("update Person set Name='WindowsRT' where Id=1");

var persons = await con.Table<Person>().ToListAsync();
http://blogs.msdn.com/b/windowsappdev_ja/archive/2012/07/25/roaming.aspx
try
{
      var foamingfile =
          await Windows.Storage.ApplicationData.Current.RoamingFolder.GetFileAsync("AdressBook.db");
      await foamingfile.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder);
}
catch (FileNotFoundException)
{
}




var localfile =
    await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("AdressBook.db");
await localfile.CopyAsync(Windows.Storage.ApplicationData.Current.RoamingFolder);
http://msdn.microsoft.com/ja-jp/library/windows/apps/xaml/hh975357.aspx
http://www.microsoft.com/ja-jp/download/details.aspx?id=30674

More Related Content

What's hot

Fast content import in Plone
Fast content import in PloneFast content import in Plone
Fast content import in Plone
Andrew Mleczko
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
Takahiro Inoue
 
MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤
Takahiro Inoue
 

What's hot (20)

PageObject
PageObject PageObject
PageObject
 
WAFFLE: Windows Authentication in Java
WAFFLE: Windows Authentication in JavaWAFFLE: Windows Authentication in Java
WAFFLE: Windows Authentication in Java
 
Fast content import in Plone
Fast content import in PloneFast content import in Plone
Fast content import in Plone
 
Writing browser extensions_in_kotlin
Writing browser extensions_in_kotlinWriting browser extensions_in_kotlin
Writing browser extensions_in_kotlin
 
Waffle at NYCJavaSig
Waffle at NYCJavaSigWaffle at NYCJavaSig
Waffle at NYCJavaSig
 
Snapshot Testing @ CocoaheadsNL
Snapshot Testing @ CocoaheadsNLSnapshot Testing @ CocoaheadsNL
Snapshot Testing @ CocoaheadsNL
 
The Ring programming language version 1.8 book - Part 49 of 202
The Ring programming language version 1.8 book - Part 49 of 202The Ring programming language version 1.8 book - Part 49 of 202
The Ring programming language version 1.8 book - Part 49 of 202
 
Using Dojo
Using DojoUsing Dojo
Using Dojo
 
Php5
Php5Php5
Php5
 
Building Your First App with MongoDB
Building Your First App with MongoDBBuilding Your First App with MongoDB
Building Your First App with MongoDB
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 
MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤
 
MongoDB NoSQL and all of its awesomeness
MongoDB NoSQL and all of its awesomenessMongoDB NoSQL and all of its awesomeness
MongoDB NoSQL and all of its awesomeness
 
Basic crud operation
Basic crud operationBasic crud operation
Basic crud operation
 
Introduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genIntroduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10gen
 
PhoneGap: Local Storage
PhoneGap: Local StoragePhoneGap: Local Storage
PhoneGap: Local Storage
 
Form1.vb
Form1.vbForm1.vb
Form1.vb
 
Building Your First App: An Introduction to MongoDB
Building Your First App: An Introduction to MongoDBBuilding Your First App: An Introduction to MongoDB
Building Your First App: An Introduction to MongoDB
 
Indexing
IndexingIndexing
Indexing
 
React.js 20150828
React.js 20150828React.js 20150828
React.js 20150828
 

Viewers also liked (6)

WindowsストアーアプリでSharpDXを動かしてみる
WindowsストアーアプリでSharpDXを動かしてみるWindowsストアーアプリでSharpDXを動かしてみる
WindowsストアーアプリでSharpDXを動かしてみる
 
XAML 入門
XAML 入門XAML 入門
XAML 入門
 
LINQ の概要とかもろもろ
LINQ の概要とかもろもろLINQ の概要とかもろもろ
LINQ の概要とかもろもろ
 
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
 
LINQ概要
LINQ概要LINQ概要
LINQ概要
 
トランザクションの設計と進化
トランザクションの設計と進化トランザクションの設計と進化
トランザクションの設計と進化
 

Similar to Windows ストアーアプリで SQLite を使ってみよう

Di web tech mail (no subject)
Di web tech mail   (no subject)Di web tech mail   (no subject)
Di web tech mail (no subject)
shubhamvcs
 

Similar to Windows ストアーアプリで SQLite を使ってみよう (20)

An introduction into Spring Data
An introduction into Spring DataAn introduction into Spring Data
An introduction into Spring Data
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
greenDAO
greenDAOgreenDAO
greenDAO
 
Creating a Whatsapp Clone - Part XI.pdf
Creating a Whatsapp Clone - Part XI.pdfCreating a Whatsapp Clone - Part XI.pdf
Creating a Whatsapp Clone - Part XI.pdf
 
Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!
 
Simple.Data intro slides
Simple.Data intro slidesSimple.Data intro slides
Simple.Data intro slides
 
Creating a Facebook Clone - Part XXVIII - Transcript.pdf
Creating a Facebook Clone - Part XXVIII - Transcript.pdfCreating a Facebook Clone - Part XXVIII - Transcript.pdf
Creating a Facebook Clone - Part XXVIII - Transcript.pdf
 
Андрей Слободяник "Test driven development using mockito"
Андрей Слободяник "Test driven development using mockito"Андрей Слободяник "Test driven development using mockito"
Андрей Слободяник "Test driven development using mockito"
 
Create methods to_insert
Create methods to_insertCreate methods to_insert
Create methods to_insert
 
Entity Framework Core: tips and tricks
Entity Framework Core: tips and tricksEntity Framework Core: tips and tricks
Entity Framework Core: tips and tricks
 
Di web tech mail (no subject)
Di web tech mail   (no subject)Di web tech mail   (no subject)
Di web tech mail (no subject)
 
PDFDemo
PDFDemoPDFDemo
PDFDemo
 
Android Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, VonageAndroid Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, Vonage
 
3 database-jdbc(1)
3 database-jdbc(1)3 database-jdbc(1)
3 database-jdbc(1)
 
Creating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdfCreating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdf
 
NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020
 
Excelsheet
ExcelsheetExcelsheet
Excelsheet
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
MVVM e Caliburn Micro for Windows Phone applications
MVVM e Caliburn Micro for Windows Phone applicationsMVVM e Caliburn Micro for Windows Phone applications
MVVM e Caliburn Micro for Windows Phone applications
 

More from ShinichiAoyagi

More from ShinichiAoyagi (10)

WPF & Windows Forms on .NET Core 3.0
WPF & Windows Forms on .NET Core 3.0WPF & Windows Forms on .NET Core 3.0
WPF & Windows Forms on .NET Core 3.0
 
【18-C-5】C# で iOS/Androidアプリ開発 - Visual Studio 2015 + Xamarin + MVVMCross -
【18-C-5】C# で iOS/Androidアプリ開発 - Visual Studio 2015 + Xamarin + MVVMCross -【18-C-5】C# で iOS/Androidアプリ開発 - Visual Studio 2015 + Xamarin + MVVMCross -
【18-C-5】C# で iOS/Androidアプリ開発 - Visual Studio 2015 + Xamarin + MVVMCross -
 
Visual Studio 2015 + Xamarin
Visual Studio 2015 + XamarinVisual Studio 2015 + Xamarin
Visual Studio 2015 + Xamarin
 
Xamarin+MVVMCross のあれこれ
Xamarin+MVVMCross のあれこれXamarin+MVVMCross のあれこれ
Xamarin+MVVMCross のあれこれ
 
うるう秒とタイムゾーン
うるう秒とタイムゾーンうるう秒とタイムゾーン
うるう秒とタイムゾーン
 
LINQ 概要 + 結構便利な LINQ to XML
LINQ 概要 + 結構便利な LINQ to XMLLINQ 概要 + 結構便利な LINQ to XML
LINQ 概要 + 結構便利な LINQ to XML
 
C# と .NET と ・・・
C# と .NET と ・・・C# と .NET と ・・・
C# と .NET と ・・・
 
メトロスタイルアプリ開発 最初の一歩
メトロスタイルアプリ開発最初の一歩メトロスタイルアプリ開発最初の一歩
メトロスタイルアプリ開発 最初の一歩
 
メトロスタイルってなに?
メトロスタイルってなに?メトロスタイルってなに?
メトロスタイルってなに?
 
ついに日本上陸!Windows Phone 7.5 アプリケーション開発
ついに日本上陸!Windows Phone 7.5 アプリケーション開発ついに日本上陸!Windows Phone 7.5 アプリケーション開発
ついに日本上陸!Windows Phone 7.5 アプリケーション開発
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Windows ストアーアプリで SQLite を使ってみよう

  • 1.
  • 3.
  • 4.
  • 5.
  • 7.
  • 8.
  • 9.
  • 10. class Person { [PrimaryKey, AutoIncrement] public int Id { get; set; } [MaxLength(20)] public string Name { get; set; } } using (var con = new SQLiteConnection( Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "AdressBook.db"))) { con.CreateTable<Person>(); con.Insert(new Person() { Name = "メトロ太郎" }); }
  • 11. var persons = con.Query<Person>("select * from Person where Id = 1"); class Result { public string Name { get; set; } } var names = con.Query<Result>("select Name from Person where Id = 1");
  • 12. var person = con.Table<Person>().Where(x => x.Id == 1).First();
  • 13. con.Execute("update Person set Name='WindowsRT' where Id=1"); var person = con.Table<Person>().Where(x => x.Id == 1).First(); person.Name = "Metro"; con.Update(person);
  • 14. var con = new SQLiteAsyncConnection( Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "AdressBook.db")); await con.CreateTableAsync<Person>(); await con.InsertAsync(new Person() { Name = "メトロ太郎" }); var person = await con.Table<Person>().Where(x => x.Id == 1).FirstAsync(); person.Name = "Metro"; await con.UpdateAsync(person); await con.ExecuteAsync("update Person set Name='WindowsRT' where Id=1"); var persons = await con.Table<Person>().ToListAsync();
  • 16. try { var foamingfile = await Windows.Storage.ApplicationData.Current.RoamingFolder.GetFileAsync("AdressBook.db"); await foamingfile.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder); } catch (FileNotFoundException) { } var localfile = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("AdressBook.db"); await localfile.CopyAsync(Windows.Storage.ApplicationData.Current.RoamingFolder);