Introduction to ADO.Net and Visual Studio Database Tools ISYS 350.

Slides:



Advertisements
Similar presentations
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Advertisements

Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Introduction to Database Processing with ADO.NET.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
VB.NET Database Tools ISYS Net Applications OLE DB Provider OLE DB Data Source OLE DB Provider ODBC Data Source SQL Server Data Source SQL Server.Net.
Introduction to Data Adapter. A Simplified View of ADO.Net Objects Ado.Net Data Provider Connection Adapter Command Reader Dataset Data Consumer WinForm.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
VB.NET Database Access ISYS 812. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
VB.NET Database Tools ISYS 573. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS546.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Introduction to ADO.Net and Visual Studio Database Tools
Access Tutorial 10 Automating Tasks with Macros
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Some Basic Database Terminology
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Databases and LINQ Visual Basic 2010 How to Program 1.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Chapter 71 Building Data-Driven ASP.NET Applications Introduction to ASP.NET By Kathleen Kalata.
Advanced Visual Basic th Edition Chapter 3: Using SQL Server Databases (c) 2007 Pearson Education Inc. All rights reserved. You may modify and copy.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
CHAPTER EIGHT Accessing Data Processing Databases.
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.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Thirteen Working with Access Databases and LINQ.
CHAPTER EIGHT Accessing Data Processing Databases.
Working with GridView Control: Adding Columns. Adding Buttons to a Bound GridView: 1. Drag the WebProduct table from Data connection to a page 2. Demo.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Using Adapter Wizard ISYS 512. Data Adapter Wizard – 2 nd Level of Using ADO.Net Configure Data Adapter and generating a dataset: –From the Data tab of.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
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.
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
CS 281 – Fall 2015 Lab 4 Parametric Query and Forms in MS Access.
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
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.
Understand Databound Controls Windows Development Fundamentals LESSON 4.2A.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Chapter 9 Working with Databases. Copyright © 2011 Pearson Addison-Wesley Introduction In this chapter you will learn: – Basic database concepts – How.
CS 281 – Fall 2010 Lab 4 Parametric Query and Forms in MS Access.
Creating SQL Database file And Displaying a Database Table in a DataGridView.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Introduction to Database Processing with ADO.NET
Visual Basic 2010 How to Program
VB.NET Using Database.
Brief description on how to navigate within this presentation (ppt)
CIS16 Application Programming with Visual Basic
Database Applications
Chapter 10 Accessing Database Files
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Introduction to ADO.Net and Visual Studio Database Tools ISYS 350

Database Processing Querying database Updating database: –Insertion, deletion, modification

Steps to Retrieve Data Establishes a connection to the database. Executes query commands against the database. –SQL Select commands Process the returned data.

Steps to Update Data Establishes a connection to the database. Executes update commands against the database. –SQL Insert, Delete, Update commands Receive confirmation of completion.

ADO.Net Classes and Data Consumer Ado.Net Connection Adapter Command DataReader Dataset Data Consumer WinForm WebForm

ADO.NET Objects Connection Object: Represent a connection to the database. Command Object: The command object allows us to execute a SQL statement or a stored procedure. DataReader: It is a read-only and forward-only pointer into a table to retrieve records. DataSet Object: A DataSet object can hold several tables and relationships between tables. DataAdapter: This the object used to pass data between the database and the dataset.

SQL Server Express LocalDB SQL Server Express LocalDB is a light- weight version of SQL Server Express that is already installed with VS 2012, and it does not bring heavy workload on development machines

Lab: Creating a LocalDB Database 1. Start SQL Server Express LocalDB: –View/SQL Server Object Explorer –Click and open: SQL Server

Lab: Creating a LocalDB Database Database Name: MyHR Table: –Employee EID: NCHAR(5) Ename: NCHAR(20) Sex: NCHAR(1) Salary: Numeric(9,2) HireDate: Datetime

To Add a New Database Open the LocalDB node Right-click Databases –Add new database Enter database name –Example: MyHR

To Add a New Table: Employee Open the Database node: Open the MyHR node Right-click Tables and select: Add New Table Change the table name to Employee –CREATE TABLE [dbo].[Employee] Define fields Click Update: –click Update Database

To Add Records Open the Tables node Right-click the table name (Employee) and select View Data

To Modify Table Design Point and right-click the table name: –Select: View/Designer Change the CREATE TABLE command Or Change the design with the designer

Data Binding Connect a control or property to one or more data elements. Simple binding: Use simple binding to display a field value in controls that show Data Bindings in the property window, such as text box or label. Complex binding: Use complex binding to bind more than one field to controls such as DataGrid and list box. Use the control’s Data Source and Data Member to bind the data.

Generating Data Bound Form with Form Wizard Creating a form with ADO.Net objects and data- bound controls to display and update information in a dataset. Step 1: Add a connection to the LocalDB database. Step 2: Add a new data source: Step 3: Select controls for table fields: –Click the dropdown list next to the table’s name: Datagrid view Details Step 4: Drag the table to form.

Add a Connection to LocalDB Database Tools/Connect to database –Click Change –Click Microsoft SQL Server: Enter Server Name: –(localdb)\Projects –Or, (localdb)\v11.0 Log on to server: –Using Windows authentication Select or enter a database name –Test Connection

Add a New Data Source Data Source window: –View/Other windows/Data Source Add New Data Source –From Database –From Dataset –Select connection –Select tables

Data Bound Form Examples Using the LocalDB database MyHR, show records of the Employee table: –with dataGridView –with detail view

Items Added to the Form Table Adapter: click smart tag –Add query –Preview data Dataset: Binding Source: It is an object that keeps track of position (the current row) of a data source. –Preview data

Other Data Form Demos DataGrid View Add /Modify/Delete records. Read only form: –Delete AddNew, Delete, Save buttons from navigator bar.

Detail Form with Bound ListBox Example: Employee table form with EID listbox and displays selected employee information in textboxes. –Choose detail view for the Employee table. –Click the dropdown list next to the EID field and click ListBox –Drag the Employee table to the form. –Bind the EID field to the BindingSource: Activate the Property window and click the listbox Set the DataSOurce property to BindingSource Set the Display Member property to EID

Add an Dependents Table to the MyHR Database Dependents table: –DependentID: NCHAR(5) –DepName: NCHAR(20) –DepRelationship: NCHAR(15) Spouse/Son/Daughter –EID: NCHAR(5) Open the Database node: Open the MyHR node Right-click Tables and select: Add New Table Change the table name to Dependents CREATE TABLE [dbo].[Dependents] Define fields Click Update; then click Update Database

Hierarchical Forms: Employee/Dependents Parent table/Child table –Add parent table and child table to Data Source –Drag the parent table and the child table to the form. Parent table uses detail view and child table uses dataGrid view –Click Dataset object’s smart tag to choose Edit in Dataset Designer –With the designer, right click the parent table and choose Add/Relation –Change dataGrid’s DataSource property to the relation.