Windows Forms Navigating database with windows forms.

Slides:



Advertisements
Similar presentations
Basics of Database Programming with VB6
Advertisements

Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
1.NET Web Forms DataGrid © 2002 by Jerry Post. 2 Data Grid Has Many Uses  The grid uses HTML tables to display multiple rows of data. It is flexible.
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.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Introduction to Data Adapter. A Simplified View of ADO.Net Objects Ado.Net Data Provider Connection Adapter Command Reader Dataset Data Consumer WinForm.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
Access Tutorial 1 Creating a Database
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
Concepts of Database Management Sixth Edition
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
Labcheck Next Generation Quick Start Guide
Visual Basic.Net Seminar June 7, Topics Today include  The.Net Framework  Studio.Net Environment  VB.Net  Introduction to VB.Net  Loops and.
Tutorial 1 Creating a Database. Objectives Learn basic database concepts and terms Learn basic database concepts and terms Explore the Microsoft Access.
Some Basic Database Terminology
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
Unit J: Creating a Database Microsoft Office Illustrated Fundamentals.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
BIM211 – Visual Programming Database Operations II 1.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Chapter 81 Building Data-Driven Web Applications Introduction to ASP.NET By Kathleen Kalata.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
BİL528 – Bilgisayar Programlama II Database Operations II 1.
Navigating database with windows forms.. Tiered applications  Provide a means to develop many presentations of the same app  Makes changes to the back.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
1/36 Database Programming with Visual Basic.Net and MS Access IKE Lab. Yunho Song Database Management and Analysis.
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.
CHAPTER EIGHT Accessing Data Processing Databases.
Unit 8.3 Learning Objectives Insert users into the ASP.NET Membership system from code Capture data being sent to the database Capture Exceptions that.
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.
Why are Databases Better than Files? Multiple users can all use the same database, and have access to the current, up to the minute values for the data.
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.
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.
Reference: “ASP.NET 2.0 Illustrated” by Alex Homer and Dave Sussman. -ch3 illustrated book
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
Chapter 24 I’m Suffering from Information Overload (Access Databases) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Ennis-Cole, AC 2.01, CECS Maintaining A Database By: Dr. Ennis-Cole.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
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.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 350.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
Windows Database Applications CIS 341 Chapter 5. Objectives Update database Navigate records Event handler Bound control maintenance Update data source.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
ASI Table [Instructor Notes, if any, will appear here.]
Database vs. DBMS Database Database Management System
Incorporating Databases with ADO.NET
test slide
Incorporating Databases with ADO.NET
VB.NET Using Database.
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
CIS16 Application Programming with Visual Basic
Chapter 10 ADO.
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Windows Forms Navigating database with windows forms.

VB.net application Tiered application  Provide a means to develop many presentations of the same app  Makes changes to the back end easier when it is not tied into one class

Tiers continued  You have three tiers Presentation (The form or front end) Business  Used to make all the calculated values in the form  Enforces the Business rules of your application Data Tier (Provides connections and manages rules (SQL) of the database)

The Data tier  A windows component added to your project  Like the form, a windows component is also a class.  This class will contain all the Connection, DataAdapters and DataSets that are needed for the data Tier. Each of these are considered to be private To access these objects and all methods and properties, require the use of Accessor methods/sub procedures that you must create

Data Tier (Continued)  Two methods are needed in the data tier 1.A function that will return a reference to the datset to the form (getDataSet()). 2.A sub procedure that will provide access to the Update method of the DataAdapter (Update()) AS a refresher  All SQL statements are managed by the DataAdapter  All Connections to the database are managed by the connection object  A local copy of the database in the DataSet

The Data Tier in detail

DataSets  DataSets hold a local copy of the database.  Any changes of the dataset have to be pushed back to the server  The Update Function in the DataAdapter takes only the rows of data that have changed and then push them onto the database.

DataSet Continued  Data can change on a DBMS on a network frequently  Once an update occurs, the DataSet must accept all changes that Occur in the DBMS  The AcceptChanges() function of the datset must be called after an update is made

Adding and Editing Form design and changing data in a database

Form design for Adding records  When adding or editing a record in the data set all navigation should be disabled. This prevents the user from accidentally moving the position of the record during an edit. All other buttons should be disabled  i.e. Edit and Delete buttons  Separate sub procedures should be created to do this

Navigation sub procedures  When a form opens All textboxes should be disabled Buttons that are not needed should also be disabled (i.e. Cancel button) This is often called enabling navigation  There are therefore two sub procedures that must be created enableNav() disableNav()

Example code of enbleNav() Private Sub enableNav() txtFirstNAme.Enabled = False txtLastName.Enabled = False txtAddress.Enabled = False txtCity.Enabled = False txtState.Enabled = False txtZip.Enabled = False btnNext.Enabled = True btnPrev.Enabled = True btnCancel.Enabled = False End Sub

Example code of disableNav() Private Sub disableNav() txtFirstNAme.Enabled = True txtLastName.Enabled = True txtAddress.Enabled = True txtCity.Enabled = True txtState.Enabled = True txtZip.Enabled = True btnPrev.Enabled = False btnNext.Enabled = False btnCancel.Enabled = True End Sub

Adding Records  The BindingManagerBase object in the form contains an AddNew() Sub Procedure which clears all bound textboxes Moves the position of the record to the end Auto increments all key id fields (if they are set for auto increment) This sub procedure is added to the event handler of the Add Button

Example Form for adding a recod

Adding a record continued  Buttons can also be used for two purposes  With the Add button Click once it places the form in a position to add a record Once the information is added to the text fields, the button can be clicked again to save the record (code provided to student).

Saving a record  There are specific steps that are taken to save a record to a database 1.Call the EndCurrentEdit() sub procedure in the BindingManagerBase object 2.Call the Update sub procedure in the DataAdapter (located in the data tier) 3.Call the AccpetChanges sub procedure in the DataSet (also located in the data tier) Taken these steps in this order will ensure that all the data will be saved to the database

Edit buttons follow the same design as add