The Use of Microsoft based Technologies for the benefit of the Community Prof. Avi Mendelson – Microsoft & Technion - Taub 643.

Slides:



Advertisements
Similar presentations
1 Web-Enabled Decision Support Systems Access Introduction: Touring Access Prof. Name Position (123) University Name.
Advertisements

Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
BIM211 – Visual Programming Database Operations 1.
BIM313 – Advanced Programming Database Operations 1.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Access Tutorial 1 Creating a Database
The Use of Microsoft based Technologies for the benefit of the Community Prof. Avi Mendelson – Microsoft & Technion - Taub 643.
Creating a Blank Database 1. Open up Microsoft Access 2. Click on Blank document button 3. On the right panel, Specify the location for saving your database.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ 1 Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Using T-sql scripts. Migrating Sql Database to SQL Azure Database Create the Test Database In SQL Server Management Studio, on the File menu, point to.
® IBM Software Group © 2006 IBM Corporation The Eclipse Data Perspective and Database Explorer This section describes how to use the Eclipse Data Perspective,
Database Updates Made Easy In WebFocus Using SQL And HTML Painter Sept 2011 Lender Processing Services 1.
Access Tutorial 10 Automating Tasks with Macros
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
1 Working with MS SQL Server II. 2 The sqlcmd Utility Command line utility for MS SQL Server databases. Previous version called osql Available on classroom.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Chapter 10 - VB.Net by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
CSCI 6962: Server-side Design and Programming
An INTRODUCTION to MICROSOFT ACESS 2000 By Dr. Ennis-Cole.
Microsoft Azure Introduction ISYS 512. Microsoft Azure Microsoft Azure is a cloud.
Databases and LINQ Visual Basic 2010 How to Program 1.
Advanced Forms Lesson 10.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
Overview of Data Access MacDonald Ch. 15 MIS 324 Professor Sandvig.
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
1 Working with MS SQL Server Textbook Chapter 14.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
ISM 4212 Lab Creating DB Tables 02 copyright Lars Paul Linden 2007.
CIS 338: Using Queries in Access as a RecordSource Dr. Ralph D. Westfall May, 2011.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
Databases with LINQ. LINQ to SQL LINQ to SQL uses LINQ syntax to query databases. LINQ to SQL classes are automatically generated by the IDE’s LINQ to.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
Presentation On How To Create Connection To A Database.
Creating and Populating a MS SQLServer Database Presented By: Dr. Adam P. Anthony.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
1 Adding a Model. We have created an MVC web app project Added a controller class. Added a view class. Next we will add some classes for managing movies.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Creating Data Base & Sql Data Source
Visual Basic 2010 How to Program
, MS-Access, QBE, Access/Oracle
Accessing Databases with ADO.NET, Handling Exceptions, and Printing
Creating Data Base & Sql Data Source
These slides are for reference only. They are not "lecture notes"
Grauer and Barber Series Microsoft Access Chapter One
Data Base.
Presentation transcript:

The Use of Microsoft based Technologies for the benefit of the Community Prof. Avi Mendelson – Microsoft & Technion - Taub 643 Prof. Ron Friedman – CS Technion – Taub 605

Agenda Linq to SQL Linq to SQL

General We would like to create a database on the phone We would like to create a database on the phone  To locate it in the ISOStorage  To manipulate it via Linq  To synchronize it with a database on the WEB

Example-1 based on msdn.microsoft.com/en-us/library/hh407285(v=VS.88).aspx msdn.microsoft.com/en-us/library/hh407285(v=VS.88).aspx msdn.microsoft.com/en-us/library/hh407285(v=VS.88).aspx An option for persisting data from your Windows Phone application is via LINQ to SQL. An option for persisting data from your Windows Phone application is via LINQ to SQL. LINQ to SQL is only available to applications written for Windows Phone OS 7.1, allowing them to read and write to a relational data store. Whilst behind the scenes data is stored in a SQL Server Compact database, there is no support for ADO.NET, or the ability to issue Transact-SQL (DDL or DML) statements directly to the database LINQ to SQL is only available to applications written for Windows Phone OS 7.1, allowing them to read and write to a relational data store. Whilst behind the scenes data is stored in a SQL Server Compact database, there is no support for ADO.NET, or the ability to issue Transact-SQL (DDL or DML) statements directly to the database

Creating the project This example uses Windows Phone application. Please note that we use 7.1 (Mango) setup

Creating the DB to be used. There are two ways to do that There are two ways to do that 1. Define the properties of the DB in the program and the program will generate the DB, initiate it and us it 2. Define the DB and connect it to the system. 1. Please note that there are many ways to create the DB, If you us a tool which is not define as part of the Phone development tools, make sure that the DB type is Compact SQL version Server SQL and AZURE SQK will be able to share it. 3. There are tools that knows how to use DB of SQL 4.0 but this is out of the scope of this discussion.

Creating the DB – cont. Right click on “data Connections” Right click on “data Connections” Choose “add connection” (not new DB) Choose “add connection” (not new DB) Select the place you like to place the DB. Select the place you like to place the DB. Please note that although the prefix is “sdf” it can be read by any SQL server Please note that although the prefix is “sdf” it can be read by any SQL server Hit “create” Hit “create” Hit OK Hit OK Now you can see the DB in the Server Explorer TAB Now you can see the DB in the Server Explorer TAB

Create Tables Open the DB tab and right click on the table Open the DB tab and right click on the table Add table name Product Add table name Product Select the primary key Select the primary key

Create another table -- Order

Using relations between the Tables We like to correlate the ProductID in the two tables. We like to correlate the ProductID in the two tables. Expand Table Expand Table Right-Click the Order table and select Table Properties and then click on the Add Relations tab. Right-Click the Order table and select Table Properties and then click on the Add Relations tab. Fill the fields respectively and hit the “add columns” Fill the fields respectively and hit the “add columns” Hit the “Add Relations” Hit the “Add Relations” OK OK Now the connection was defined. Now the connection was defined.

Adding Linq interfaces to the DB You can build the interfaces your self or use an existing tools which is provided as part pf the “visual studio 2010” called SqlMetal. You can build the interfaces your self or use an existing tools which is provided as part pf the “visual studio 2010” called SqlMetal. Start -> All Programs -> Visual Studio > Visual Studio Tools -> Visual Studio Command Prompt Start -> All Programs -> Visual Studio > Visual Studio Tools -> Visual Studio Command Prompt Move to the folder into which you created the SQL Server Compact database file. Move to the folder into which you created the SQL Server Compact database file. sqlmetal productsales.sdf /code:productsales.cs /pluralize

Add references and class Add the newly created productsales.cs file via “Add Existing Item”. Add the newly created productsales.cs file via “Add Existing Item”. Add a reference to the class library System.Data.Linq.dll (via the Add Reference option from the Solution Explorer window). Add a reference to the class library System.Data.Linq.dll (via the Add Reference option from the Solution Explorer window).

Comment out containers not needed Only string connection is needed Only string connection is needed Now you can compile it Now you can compile it

Create the DB in the ISOStorage

Create and initialize the Table Please note that the last insert below is using Add since this is a foreign key Please note that the last insert below is using Add since this is a foreign key

DB Query We like to search the DB using Linq We like to search the DB using Linq

Code and output

Using local DB as a cache There are few tools that allow you to do that There are few tools that allow you to do that But this simplest way is But this simplest way is  Create a local SQL-DB  Create a similar DB on a server or cloud (AZURE)  Option-1: each time you change a field on the local DB modify it on the global DB as well  Option-2:  Add a field to each record that indicate if you change it.  Periodically update all modified fields to the global and “clean” the modified field  You can also count how many modified fields exist and update only if it exceed some number.  You can also add an indication of last time accessed and clean each entry that aged.