Mahasiswa dapat menjelaskan dan mengaplikasikan ADO .NET II Pada Pemrograman C#
Referensi: Deitel, H & Deitel, P. (2012), Visual C# 2012 How to Program (5th Edition) (How to Program (Deitel))
Pemrograman Visual Minggu …10…
Page 1 Agenda • Basic Select Query • Where Clause • Order By Clause • Retrieving data from multiple TABLES: Inner join • Insert Statement • Update Statement • Delete Statement Pemrograman Visual Minggu …10… Page 2 Introduction • A database is an integrated collection of data • DBMS (Database Management System) • SQL (Structured Query Language) • Microsoft Access, Microsoft SQL, MySQL, Oracle, Dbase, Sybase, DB2
Pemrograman Visual Minggu …10… Page 3
Relational Database Model • The relational database model is a logical representation of data that allows relationships among data to be considered without concern for the physical structure of the data • Database, Tables, Records, Fields, Characters • Database Specification
Pemrograman Visual Minggu …10… Page 4
Database • Database – Tables • Records – Fields » Chars • Example of Table: number name departmentsalary location 23603 Jones 413 1100 New Jersey 24568 Kerwin 413 2000 New Jersey 34589 Larson 642 1800 Los Angles 36761 Myers 611 1400 Orlando 47132 Neumann 413 9000 New Jersey 78321 Stephens 611 8500 Orlando Pemrograman Visual Minggu …10… Page 5 Database Specification • Spesifikasi database adalah uraian atau deskripsi detail atribute yang ada dalam masing-masing tables • Example of database spesifikasi:
Nama Fields Type Length Deskripsi
numer chars 5 name chars 25 department chars 3 salary number/integer 9 location chars 15
Pemrograman Visual Minggu …10… Page 6
Book Database Authors Publishers AuthorISBN authorID firstName lastName publishersID publisherName authorID isbn 1 Harvey Deitel 1 Prentice Hall 2 Paul Deitel 1 130895725 2 Prentice HallPTG 3 Tem Neito 1 132261197 4 Kate Steinbuhler 1 130895717 5 Sean Santry 6 Ted Lin 1 135289106 7 Praveen Sadhu 2 130895725 8 David MePhie 2 132261197 9 Cheryl Yaeger 2 130895717 10 Marina Zlatkina 11 Ben Wiedermann 2 130895717 12 Jonathan Liperi 2 135289106
Pemrograman Visual Minggu …10… Page 7
Select Query • Select * from tablename • Select * from authors • Select authorID, lastname from Authors • Select * from authorISBN Where authorID=‘1’ • Select * from Publishers Where publisherName like ‘D*’ • * = one or more characters, ? = one characters • Select authorsID, firstName order by firsName ASC • Select fieldName1, fieldName2 From table1 inner join table2 on table1.fieldname=table2.fieldname
Pemrograman Visual Minggu …10… Page 8
Insert, Update, Delete • Insert into tablename (fieldname1, fieldname2, fieldname3) values (value1, value2, value3) • Update tablename set fieldname1=value1, fieldname2=value2, fieldname3=value3 where criteria • Delete From tablename where criteria
Pemrograman Visual Minggu …10… Page 9
Example Insert
Pemrograman Visual Minggu …10… Page
10 Example Update Access
Pemrograman Visual Minggu …10… Page
11 Example Update Sql Server
Pemrograman Visual Minggu …10… Page
12 Example Delete
Pemrograman Visual Minggu …10… Page
13 Example DML – Data Adapter Data Binding
Pemrograman Visual Minggu …10… Page
14 Example DML – Data Adapter Data Binding (Insert)
Pemrograman Visual Minggu …10… Page
15 Example DML – Data Adapter Data Binding (Update)
Pemrograman Visual Minggu …10… Page
16 Example DML – Data Adapter Data Binding (Delete)
Pemrograman Visual Minggu …10… Page
17 Example DML – Data Adapter Data Binding (Navigation)