Navigating database with windows forms.. Tiered applications  Provide a means to develop many presentations of the same app  Makes changes to the back.

Slides:



Advertisements
Similar presentations
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
Advertisements

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 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
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.
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.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Microsoft Visual Basic 2012 CHAPTER TEN Incorporating Databases with ADO.NET.
Tutorial 1 Creating a Database. Objectives Learn basic database concepts and terms Learn basic database concepts and terms Explore the Microsoft Access.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
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.
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.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
BİL528 – Bilgisayar Programlama II Database Operations II 1.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
® Microsoft Access 2010 Tutorial 1 Creating a Database.
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.
So – You want to learn how to put a BLOG article onto the state website. (Note: If you have not done so, you will need to review the web training provided.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
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.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
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.
Windows Forms Navigating database with windows forms.
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
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.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
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.
Mauricio Featherman, Ph.D. Washington St. University
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access.
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.
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.
Windows Database Applications CIS 341 Chapter 5. Objectives Update database Navigate records Event handler Bound control maintenance Update data source.
Chapter 9 Working with Databases. Copyright © 2011 Pearson Addison-Wesley Introduction In this chapter you will learn: – Basic database concepts – How.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
Creating Data Base & Sql Data Source
ADO.NET Framework.
Database vs. DBMS Database Database Management System
Incorporating Databases with ADO.NET
test slide
Incorporating Databases with ADO.NET
VB.NET Using Database.
DB Implementation: MS Access Forms
CIS16 Application Programming with Visual Basic
Chapter 10 ADO.
Database Applications
Creating Data Base & Sql Data Source
Chapter 10 Accessing Database Files
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Navigating database with windows forms.

Tiered applications  Provide a means to develop many presentations of the same app  Makes changes to the back end easier when it is not tied into the front end (presentation Tier)

 Provides more portability for code created in each business app.  Provides a way to create a Data connection that is a web service on a network.  Can easily create multiple apps for different platforms at the same time.  Apps for mobile devices  Apps for Windows  Apps for the web

 You have three basic 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  Enforces data validation  Data Tier (Provides connections and manages rules (SQL) of the database)  The data tier can be created for any DBMS  Can be a Windows/Web service providing data to multiple apps on a network.

 To create a Data Tier  Right click on the project and select new Item  Select new class  This class will contain references to the TableAdapters and DataSet  The TableAdapter contains the Connection, DataAdapters and Command Objects that are needed for the data Tier.  To access these objects and all methods and properties, require the use of Accessor methods/sub procedures that you must create

 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 TableAdapter (setDB()) AS a refresher  All SQL statements are managed by the DataAdapter located inside the TableAdapter.  All Connections to the database are managed by the connection object which is also located inside the TableAdapter.  A local copy of the database in the DataSet

 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 TableAdapter takes only the rows of data that have changed and then push them onto the database.  The Accept method of the DataSet is needs to be called once an update is performed.  The Accept method clears all flags associated with rows that have been updated.

 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

Form design and changing data in a database

 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  EnableNav()  EnableEdit()

 When a form opens  All textboxes should be disabled and ready for navigation  Buttons that are not needed should also be disabled (i.e. Cancel button)  With the enable navigation function you have a choice of disabling the control or to make it Read only (programmer preverence)  The enable Edit will  Enable all the textboxes and disable all navigation.  By disabling navigation during edits, you prevent accidently editing a different record in the DB  The edit or Add button’s text should change to a save button. This saves on Form real estate.

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

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

 The Binding Manager 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 needed in the event handler of the Add Button in order for users to add a record to the DB.

 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).

 There are specific steps that are taken to save a record to a database 1. Call the EndEdit() sub procedure in the Binding Manager object 2. Call the setDB() sub procedure in the DataTier This sub procedure in the Data Tier will call the update method in the Table Adapter. (please read tutorial on how to create 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