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 

More Related Content

PPTX
MySQL Indexes
PDF
1.4 data cleaning and manipulation in r and excel
PDF
BP208 Fabulous Feats with @Formula
PPTX
Obtain better data accuracy using reference tables
PPTX
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
DOCX
Dbms practical list
PDF
CIS 336 Final Exam 2 (Devry)p
PPTX
Sql operator
MySQL Indexes
1.4 data cleaning and manipulation in r and excel
BP208 Fabulous Feats with @Formula
Obtain better data accuracy using reference tables
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Sessi...
Dbms practical list
CIS 336 Final Exam 2 (Devry)p
Sql operator

What's hot (20)

PDF
CIS 336 Final Exam 2 (Devry)s
TXT
Array operators
DOC
@Prompt
PPTX
MongoDB
PPTX
3. R- list and data frame
PDF
Data manipulation language
PPTX
07.3. Android Alert message, List, Dropdown, and Auto Complete
DOCX
Learning sql from w3schools
DOCX
Correlated update vs merge
ODP
Chetan postgresql partitioning
PPTX
Crash course in sql
DOC
Dbms lab Manual
DOC
30 08 Final Sql
PDF
Database Management System 1
PDF
PDF
Vtiger picklist 创建实例
PPTX
SQL Server Learning Drive
PPTX
Oraclesql
PDF
Data Preparation- handling missing value
PDF
CIS 336 Final Exam 2 (Devry)s
Array operators
@Prompt
MongoDB
3. R- list and data frame
Data manipulation language
07.3. Android Alert message, List, Dropdown, and Auto Complete
Learning sql from w3schools
Correlated update vs merge
Chetan postgresql partitioning
Crash course in sql
Dbms lab Manual
30 08 Final Sql
Database Management System 1
Vtiger picklist 创建实例
SQL Server Learning Drive
Oraclesql
Data Preparation- handling missing value
Ad

Viewers also liked (8)

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

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

PPTX
Session #5 content providers
PPTX
Create an android app for database creation using.pptx
PPTX
Session #4 b content providers
PPTX
Unit - IV (1).pptx
PPTX
Unit - IV.pptx
PPTX
Data Handning with Sqlite for Android
PDF
10.Local Database & LINQ
PPTX
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
PDF
Android Level 2
ODP
Sql lite android
PPT
Android SQLite database oriented application development
PPT
SQLITE Android
PPTX
Android Database
PPTX
Cordova training - Day 9 - SQLITE
PPTX
09.1. Android - Local Database (Sqlite)
PPTX
DOCX
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
PPTX
Python SQLite3...
PPTX
android sqlite
PPT
Sq lite database
Session #5 content providers
Create an android app for database creation using.pptx
Session #4 b content providers
Unit - IV (1).pptx
Unit - IV.pptx
Data Handning with Sqlite for Android
10.Local Database & LINQ
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Android Level 2
Sql lite android
Android SQLite database oriented application development
SQLITE Android
Android Database
Cordova training - Day 9 - SQLITE
09.1. Android - Local Database (Sqlite)
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
Python SQLite3...
android sqlite
Sq lite database

Recently uploaded (20)

PDF
Classroom Observation Tools for Teachers
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
master seminar digital applications in india
PDF
Pre independence Education in Inndia.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Insiders guide to clinical Medicine.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Pharma ospi slides which help in ospi learning
PDF
Business Ethics Teaching Materials for college
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
PPH.pptx obstetrics and gynecology in nursing
Classroom Observation Tools for Teachers
O7-L3 Supply Chain Operations - ICLT Program
Supply Chain Operations Speaking Notes -ICLT Program
master seminar digital applications in india
Pre independence Education in Inndia.pdf
TR - Agricultural Crops Production NC III.pdf
Microbial diseases, their pathogenesis and prophylaxis
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Renaissance Architecture: A Journey from Faith to Humanism
Insiders guide to clinical Medicine.pdf
VCE English Exam - Section C Student Revision Booklet
STATICS OF THE RIGID BODIES Hibbelers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Pharma ospi slides which help in ospi learning
Business Ethics Teaching Materials for college
Module 4: Burden of Disease Tutorial Slides S2 2025
PPH.pptx obstetrics and gynecology in nursing

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>