SlideShare a Scribd company logo
Builders & Developers
Workshop
SESSION 8
PREPARED & PRESENTED BY : MOATASIM MAGDY
Our topic today
Database
Why database ?
Queries
Create
Select
Insert
Update
Delete
Drop
Create Table
CREATE TABLE table_name
(
Column_name1 data_type(Size),
Column_name2 data_type(Size),
Column_name3 data_type(Size),
…….
);
Insert Query
INSERT INTO table_name
VALUES (value1, value2 , value3 …);
OR
INSERT INTO table_name
(column1, column2, column3 ….)
VALUES (value1, value2 , value3 …);
Select query
SELECT column_name, column_name2
FROM table_name
WHERE column_name operator value;
OR
SELECT *
FROM table_name
WHERE column_name operator value;
Operators
= Equal
<> Not equal
> Greater than
< Less than
>= Greater than
<= Less than
LIKE Search for pattern
Update query
UPDATE table_name
SET column1 = VALUE, column2 = VALUE
WHERE some_column = some_value;
Delete Query
DELETE FROM table_name
WHERE some_column = some_value;
Drop Table
DROP TABLE table_name
How to connect Your Universal
application with sqlite ?
Step 1
First press tools then open extensions and updates, make sure these
2 extensions are available.
Step 2
Then from solution explorer right
click on references from windows 8.1
part then select add reference.
Step 3
After you open reference manager in windows phone select this.
Step 4
Then from solution explorer right
click on references from windows
8.1 part then select add reference.
Step 5
After you open reference manager in windows phone select this.
Step 6
You will notice these warnings in
windows and windows phone
Step 7
To solve this warnings open
configuration manager from the
Debug in the top bar of visual
studio.
Step 8
Right click on the project from solution and explorer then open
“manage nugget packages” and search for sqlite-net then install.
Step 9
To make sure every thing is going
right you`ll notice appearance of
this 2 classes in windows and
windows phone part.
Connect your database with C#
Create Database.
Check existence of database.
Create Table , Create using database connection.
Add record(s) to your table
Select record from your table
Remove record from your table
Update record from your table
Drop table
Database
Open create if not existence
Check if not exist
Table
We start defining the class that
represent the table row ->
Then add the table
to the database
Add a record to a table
Add one record. Add more than one record
Select record from your table
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("people.db");
var cityUsers = await conn.QueryAsync<User>(
"SELECT * FROM Users WHERE Name = ?", new object[] { textbox1.Text
});
foreach (var user in cityUsers)
{
UserList.ItemsSource = cityUsers;
}
Select all records
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("people.db");
bool dbExist = await CheckDbAsync("people.db");
if (!dbExist)
{
await CreateDataBase();
}
var query = conn.Table<User>();
users = await query.ToListAsync();
UserList.ItemsSource = users;
Delete Record
private void Button_Click_5(object sender, RoutedEventArgs e)
{
var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
"people.db");
using (var db = new SQLite.SQLiteConnection(dbPath))
{ try
{ db.Execute("DELETE FROM Users WHERE Name = ?", textbox1.Text); }
catch (Exception ex)
{ // EXCEPTION HANDLING }}}
Update Record
private void Button_Click_6(object sender, RoutedEventArgs e)
{
var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
"people.db");
using (var db = new SQLite.SQLiteConnection(dbPath))
{ try
{ db.Execute("UPDATE Users SET Name = ? WHERE Name = ?", textbox2.Text,textbox1.Text);
}
catch (Exception ex)
{ // EXCEPTION HANDLING }}}
Drop Table
XAML: How to do list ?
<ListView x:Name="UserList" Margin="671,53,20,20">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="10">
<TextBlock Text="{Binding Name}" />
<TextBlock Text="{Binding City}" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Session 8 connect your universal application with database .. builders & developers workshop MSTC15
Summary
Any questions ?
Thank you 
Ad

More Related Content

What's hot (20)

CIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)sCIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)s
critterc07
 
Array operators
Array operatorsArray operators
Array operators
RamakrishnaChava5
 
@Prompt
@Prompt@Prompt
@Prompt
sun93kum
 
MongoDB
MongoDBMongoDB
MongoDB
LearningTech
 
3. R- list and data frame
3. R- list and data frame3. R- list and data frame
3. R- list and data frame
krishna singh
 
Data manipulation language
Data manipulation languageData manipulation language
Data manipulation language
PratibhaRashmiSingh
 
07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete
Oum Saokosal
 
Learning sql from w3schools
Learning sql from w3schoolsLearning sql from w3schools
Learning sql from w3schools
farhan516
 
Correlated update vs merge
Correlated update vs mergeCorrelated update vs merge
Correlated update vs merge
Heribertus Bramundito
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
OpenSourceIndia
 
Crash course in sql
Crash course in sqlCrash course in sql
Crash course in sql
Mithun Shanbhag
 
Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
Vivek Kumar Sinha
 
30 08 Final Sql
30 08 Final Sql30 08 Final Sql
30 08 Final Sql
sarov
 
Database Management System 1
Database Management System 1Database Management System 1
Database Management System 1
Swapnali Pawar
 
Radgrid
RadgridRadgrid
Radgrid
Aravindharamanan S
 
Vtiger picklist 创建实例
Vtiger picklist 创建实例Vtiger picklist 创建实例
Vtiger picklist 创建实例
YUCHENG HU
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive
TechandMate
 
Oraclesql
OraclesqlOraclesql
Oraclesql
Priya Goyal
 
Data Preparation- handling missing value
Data Preparation- handling missing valueData Preparation- handling missing value
Data Preparation- handling missing value
Rupak Roy
 
R factors
R   factorsR   factors
R factors
Learnbay Datascience
 
CIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)sCIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)s
critterc07
 
3. R- list and data frame
3. R- list and data frame3. R- list and data frame
3. R- list and data frame
krishna singh
 
07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete
Oum Saokosal
 
Learning sql from w3schools
Learning sql from w3schoolsLearning sql from w3schools
Learning sql from w3schools
farhan516
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
OpenSourceIndia
 
30 08 Final Sql
30 08 Final Sql30 08 Final Sql
30 08 Final Sql
sarov
 
Database Management System 1
Database Management System 1Database Management System 1
Database Management System 1
Swapnali Pawar
 
Vtiger picklist 创建实例
Vtiger picklist 创建实例Vtiger picklist 创建实例
Vtiger picklist 创建实例
YUCHENG HU
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive
TechandMate
 
Data Preparation- handling missing value
Data Preparation- handling missing valueData Preparation- handling missing value
Data Preparation- handling missing value
Rupak Roy
 

Viewers also liked (8)

Session five Builders & developers workshop MSTC`15
Session five Builders & developers workshop MSTC`15Session five Builders & developers workshop MSTC`15
Session five Builders & developers workshop MSTC`15
Moatasim Magdy
 
Session three Builders & developers workshop Microsoft Tech Club 2015
Session three Builders & developers workshop Microsoft Tech Club 2015Session three Builders & developers workshop Microsoft Tech Club 2015
Session three Builders & developers workshop Microsoft Tech Club 2015
Moatasim Magdy
 
Session seven Builders & Developers workshop MSTC`15
Session seven Builders & Developers workshop MSTC`15Session seven Builders & Developers workshop MSTC`15
Session seven Builders & Developers workshop MSTC`15
Moatasim Magdy
 
Session four introduction to XAML builders and developers workshop MSTCCU`15
Session four introduction to XAML builders and developers workshop MSTCCU`15Session four introduction to XAML builders and developers workshop MSTCCU`15
Session four introduction to XAML builders and developers workshop MSTCCU`15
Moatasim Magdy
 
MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net
MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net
MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net
Moataz_Hesham
 
Builders and Developers Session one MSTC`15
Builders and Developers Session one MSTC`15Builders and Developers Session one MSTC`15
Builders and Developers Session one MSTC`15
Moatasim Magdy
 
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
Wagdy Mohamed
 
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Wagdy Mohamed
 
Session five Builders & developers workshop MSTC`15
Session five Builders & developers workshop MSTC`15Session five Builders & developers workshop MSTC`15
Session five Builders & developers workshop MSTC`15
Moatasim Magdy
 
Session three Builders & developers workshop Microsoft Tech Club 2015
Session three Builders & developers workshop Microsoft Tech Club 2015Session three Builders & developers workshop Microsoft Tech Club 2015
Session three Builders & developers workshop Microsoft Tech Club 2015
Moatasim Magdy
 
Session seven Builders & Developers workshop MSTC`15
Session seven Builders & Developers workshop MSTC`15Session seven Builders & Developers workshop MSTC`15
Session seven Builders & Developers workshop MSTC`15
Moatasim Magdy
 
Session four introduction to XAML builders and developers workshop MSTCCU`15
Session four introduction to XAML builders and developers workshop MSTCCU`15Session four introduction to XAML builders and developers workshop MSTCCU`15
Session four introduction to XAML builders and developers workshop MSTCCU`15
Moatasim Magdy
 
MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net
MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net
MSTCCU'16 - Aspiration Webbers - Session 1 - Introduction To ASP.net
Moataz_Hesham
 
Builders and Developers Session one MSTC`15
Builders and Developers Session one MSTC`15Builders and Developers Session one MSTC`15
Builders and Developers Session one MSTC`15
Moatasim Magdy
 
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
Wagdy Mohamed
 
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Wagdy Mohamed
 
Ad

Similar to Session 8 connect your universal application with database .. builders & developers workshop MSTC15 (20)

MySQL Presentation
MySQL PresentationMySQL Presentation
MySQL Presentation
Manish Bothra
 
Databases with SQLite3.pdf
Databases with SQLite3.pdfDatabases with SQLite3.pdf
Databases with SQLite3.pdf
Deepika,Assistant Professor,PES College of Engineering ,Mandya
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
Tony Wong
 
Module 3
Module 3Module 3
Module 3
cs19club
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
info_zybotech
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
info_zybotech
 
chapter 8 SQL.ppt
chapter 8 SQL.pptchapter 8 SQL.ppt
chapter 8 SQL.ppt
YitbarekMurche
 
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
Mukesh Tekwani
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
webhostingguy
 
Chapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfChapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdf
TamiratDejene1
 
SQl data base management and design
SQl     data base management  and designSQl     data base management  and design
SQl data base management and design
franckelsania20
 
database in my squel assignment for students.pdf
database in my squel assignment for students.pdfdatabase in my squel assignment for students.pdf
database in my squel assignment for students.pdf
mashorialli500
 
Data Manipulation Language.pptx
Data Manipulation Language.pptxData Manipulation Language.pptx
Data Manipulation Language.pptx
EllenGracePorras
 
DBMS LAB M.docx
DBMS LAB M.docxDBMS LAB M.docx
DBMS LAB M.docx
SuhaniSinha9
 
Training on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptxTraining on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptx
naibedyakar00
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptx
SiddhantBhardwaj26
 
Database concepts
Database conceptsDatabase concepts
Database concepts
ACCESS Health Digital
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
webhostingguy
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
Tony Wong
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
info_zybotech
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
info_zybotech
 
Chapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfChapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdf
TamiratDejene1
 
SQl data base management and design
SQl     data base management  and designSQl     data base management  and design
SQl data base management and design
franckelsania20
 
database in my squel assignment for students.pdf
database in my squel assignment for students.pdfdatabase in my squel assignment for students.pdf
database in my squel assignment for students.pdf
mashorialli500
 
Data Manipulation Language.pptx
Data Manipulation Language.pptxData Manipulation Language.pptx
Data Manipulation Language.pptx
EllenGracePorras
 
Training on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptxTraining on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptx
naibedyakar00
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptx
SiddhantBhardwaj26
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
Ad

Recently uploaded (20)

CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
Unit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its typesUnit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its types
bharath321164
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Studying Drama: Definition, types and elements
Studying Drama: Definition, types and elementsStudying Drama: Definition, types and elements
Studying Drama: Definition, types and elements
AbdelFattahAdel2
 
Diabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomicDiabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomic
Pankaj Patawari
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
Unit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its typesUnit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its types
bharath321164
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Studying Drama: Definition, types and elements
Studying Drama: Definition, types and elementsStudying Drama: Definition, types and elements
Studying Drama: Definition, types and elements
AbdelFattahAdel2
 
Diabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomicDiabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomic
Pankaj Patawari
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 

Session 8 connect your universal application with database .. builders & developers workshop MSTC15

  • 1. Builders & Developers Workshop SESSION 8 PREPARED & PRESENTED BY : MOATASIM MAGDY
  • 5. Create Table CREATE TABLE table_name ( Column_name1 data_type(Size), Column_name2 data_type(Size), Column_name3 data_type(Size), ……. );
  • 6. Insert Query INSERT INTO table_name VALUES (value1, value2 , value3 …); OR INSERT INTO table_name (column1, column2, column3 ….) VALUES (value1, value2 , value3 …);
  • 7. Select query SELECT column_name, column_name2 FROM table_name WHERE column_name operator value; OR SELECT * FROM table_name WHERE column_name operator value;
  • 8. Operators = Equal <> Not equal > Greater than < Less than >= Greater than <= Less than LIKE Search for pattern
  • 9. Update query UPDATE table_name SET column1 = VALUE, column2 = VALUE WHERE some_column = some_value;
  • 10. Delete Query DELETE FROM table_name WHERE some_column = some_value; Drop Table DROP TABLE table_name
  • 11. How to connect Your Universal application with sqlite ?
  • 12. Step 1 First press tools then open extensions and updates, make sure these 2 extensions are available.
  • 13. Step 2 Then from solution explorer right click on references from windows 8.1 part then select add reference.
  • 14. Step 3 After you open reference manager in windows phone select this.
  • 15. Step 4 Then from solution explorer right click on references from windows 8.1 part then select add reference.
  • 16. Step 5 After you open reference manager in windows phone select this.
  • 17. Step 6 You will notice these warnings in windows and windows phone
  • 18. Step 7 To solve this warnings open configuration manager from the Debug in the top bar of visual studio.
  • 19. Step 8 Right click on the project from solution and explorer then open “manage nugget packages” and search for sqlite-net then install.
  • 20. Step 9 To make sure every thing is going right you`ll notice appearance of this 2 classes in windows and windows phone part.
  • 21. Connect your database with C# Create Database. Check existence of database. Create Table , Create using database connection. Add record(s) to your table Select record from your table Remove record from your table Update record from your table Drop table
  • 22. Database Open create if not existence Check if not exist
  • 23. Table We start defining the class that represent the table row -> Then add the table to the database
  • 24. Add a record to a table Add one record. Add more than one record
  • 25. Select record from your table SQLiteAsyncConnection conn = new SQLiteAsyncConnection("people.db"); var cityUsers = await conn.QueryAsync<User>( "SELECT * FROM Users WHERE Name = ?", new object[] { textbox1.Text }); foreach (var user in cityUsers) { UserList.ItemsSource = cityUsers; }
  • 26. Select all records SQLiteAsyncConnection conn = new SQLiteAsyncConnection("people.db"); bool dbExist = await CheckDbAsync("people.db"); if (!dbExist) { await CreateDataBase(); } var query = conn.Table<User>(); users = await query.ToListAsync(); UserList.ItemsSource = users;
  • 27. Delete Record private void Button_Click_5(object sender, RoutedEventArgs e) { var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "people.db"); using (var db = new SQLite.SQLiteConnection(dbPath)) { try { db.Execute("DELETE FROM Users WHERE Name = ?", textbox1.Text); } catch (Exception ex) { // EXCEPTION HANDLING }}}
  • 28. Update Record private void Button_Click_6(object sender, RoutedEventArgs e) { var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "people.db"); using (var db = new SQLite.SQLiteConnection(dbPath)) { try { db.Execute("UPDATE Users SET Name = ? WHERE Name = ?", textbox2.Text,textbox1.Text); } catch (Exception ex) { // EXCEPTION HANDLING }}}
  • 30. XAML: How to do list ? <ListView x:Name="UserList" Margin="671,53,20,20"> <ListView.ItemTemplate> <DataTemplate> <StackPanel Margin="10"> <TextBlock Text="{Binding Name}" /> <TextBlock Text="{Binding City}" /> </StackPanel> </DataTemplate> </ListView.ItemTemplate> </ListView>