Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.

Similar presentations


Presentation on theme: "Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases."— Presentation transcript:

1 Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases within ASP.NET –Creating and consuming a database web service

2 Web Services and Databases Web service is logical and secure front end to a database Insulates application from technical issues such and database connection and executing formal queries Restricts degree access hence protecting database from clumsy or malicious applications

3 ADO.NET Classes for the instantiation of ActiveX Data Objects Objects provide a means to access and manipulate databases both locally and across the web. Uses the XML format for holding data, transactions across the web and storing data.

4 Relational Databases Database management systems –Microsoft Access, Microsoft Sequel Server, Oracle, FoxPro, MySQL Databases hold items of information and the relationships between such items Relational Databases typically consist of… –Tables of information each containing rows of data records –Each data record consisting of fields of data items –Each record has a unique primary key –Linkages between records in different tables via foreign keys

5 Exercise 8.1 Create a table of student records where primary key is RollNumber

6 Structured Query Language (SQL) Simple text based language to communicate with database management system Construct simple statements to… –Get and set items –Add or delete records –Test relationships between data.

7 Examples SELECT record FROM table WHERE record = value For example… SELECT Surname FROM Students WHERE FirstName='Dave‘ INSERT INTO table ( fieldname, fieldname, fieldname) values ( value, value, value) For example… INSERT INTO Students ( ‘FirstName’, ‘Surname’) values ( ‘Fred’, ‘Bloggs’) UPDATE Students SET fieldname= value WHERE fieldname= value For example… UPDATE Students SET FirstName='Fred' WHERE Surname='Barlow'

8 Connecting to database with Ole objects (Object Link Embedding) ‘Microsoft Jet 4.0 OLE DB Provider’ System.Data.OleDb.OleDbConnection System.Data.OleDb.OleDbCommand System.Data.OleDb.OleDbDataReader

9 Queries and Non Queries For select statements use.. OleDbDataReader myDataReader=myCommand.ExecuteReader(); For insert and update statements use… myCommand.ExecuteNonQuery();

10 Exercise 8.2 Create a web service that passes an SQL query to a database and returns a result Consume that web service from ASP.NET


Download ppt "Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases."

Similar presentations


Ads by Google