Interacting with Databases Chapter 10. VB and Databases u It is often useful to have a VB program access data stored in a file other than a text file.

Slides:



Advertisements
Similar presentations
Chapter 1 Databases and Database Objects: An Introduction
Advertisements

Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
Using VB with MS Applications R. Juhl, Delta College.
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 1 Databases and Database Objects: An Introduction
Integrating Access with the Web and with Other Programs.
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
DATA Control. Data Control caption Get first Get previous Get next Get last.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab10 Interacting with Data (Database Management)
Database Programming (using ADO) Universal Data Access – Microsoft strategy for providing access to information across the enterprise. – UDA provides high-performance.
Component 8, Slide 1 CP2030 Visual basic for C++ Programmers, ‘The VB Team’ Copyright © University of Wolverhampton CP2030 Visual Basic For C++ Programmers.
Microsoft Visual Basic 2012 CHAPTER TEN Incorporating Databases with ADO.NET.
WORKING WITH FILES, MENUS AND DATABASES IN VISUAL BASIC BY V. V. SUBRAHMANYAM.
Chapter 12: Recording Macros Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Chapter 8 Relational Databases ActiveX Database Controls 8 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Handling of data from multiple databases. Visual Basic Database Visual Basic application acts as a front-end to the database Visual Basic application.
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 1 Databases and Database Objects: An Introduction
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Copyright © 2008 Prentice-Hall. All rights reserved. Committed to Shaping the Next.
Copyright © 2001 by Wiley. All rights reserved. Chapter 9: Introduction to Working with Databases in Visual Basic Database Concepts Relational 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.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Thirteen Working with Access Databases and LINQ.
Database Management School of Business Eastern Illinois University © Abdou Illia, Fall 2002 (Week 16, Monday 12/09/2002)
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 1 Introduction.
Access Manual 2 By Dhawala Kovuri Elham S.Khorasani Ismail Guneydas.
You can use Access forms to create an interface to your reports and queries. You can add: Buttons to initiate reports and queries Combo Boxes, List.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 15 Advanced Tables.
Using Microsoft Word & Excel §Open a new document in MS Word §Click on Tools & then Mail Merge l a dialogue box, like the one on this page, will appear.
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.
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.
Microsoft Office XP Illustrated Introductory, Enhanced Tables and Queries Using.
Access Forms and Queries. Entering Data in Your Table  You can add data to your table in Datasheet view, by typing in the columns and rows.  This.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
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.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
Lab 8 Data Access Using Microsoft ActiveX Data Object (ADO)
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 25 I’m Suffering from Information Overload.
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.
Filters, Pivot Table and Charts -Abdul Mohammed. Overview  Data Sorting (Filtering)  Data Summarization  Automatically summarize and sort data(Pivot.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
Using a Database Access97 Please use speaker notes for additional information!
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.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
Data Control In this presentation… –databases supported –inserting a data control –data control properties –using the data control.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Microsoft Visual Basic 2010: Reloaded Fourth Edition
GO! with Microsoft Office 2016
Database vs. DBMS Database Database Management System
GO! with Microsoft Access 2016
Listing 9.1 ShowLocalConnection.aspx
5. Using databases in VB.
Integrating Word, Excel, and Access
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Microsoft Office Access 2003
Microsoft Office Access 2003
INFO/CSE 100, Spring 2006 Fluency in Information Technology
Chapter 1 Databases and Database Objects: An Introduction
I dragged over the label tool (A icon) and put it on the form.
Working With Databases
Presentation transcript:

Interacting with Databases Chapter 10

VB and Databases u It is often useful to have a VB program access data stored in a file other than a text file  Access, dBaseIV, FoxPro, etc. u Such files, called databases have a special, complex structure which supports multiple data sets  The sequential file access methods we've learned will not help us access these files

File Database Structure u Databases are a collection of data tables (like files)  Tables are sets of records  Records are sets of fields  Fields are variable types  All records in the same table contain the same fields Database Table Record Field 1 Field 2 Field 3 Field 4 Field 5

The Data Control u VB provides a special control, the Data Control, for accessing database content  The Data Control can also be used with  Excel files  record-based text files Go to first record Go to previous record Caption Go to next record Go to last record

Using the Data Control u When using the Data Control, you may need to configure following Properties:  Name  Caption  Connect  DatabaseName  RecordSource

Name, Caption and Connect u Name Property  This should start with dat  datNavigation u Caption Property  Change this user-visible property to something which describes the data source  Browse Student Data u Connect Property  The connect property specifies the type of data source you are using  A table from a database (several formats)  An Excel spreadsheet  A text file with record-based data

DatabaseName u This property allows you to browse through the files in the file system u In this example, since the Connect property has been set to Access 2000, the browse window will only display files created with MS Access

RecordSource u This property allows you to select one table from the set of all tables inside the database  Select a table  Now the Data Control is linked to the given table of the database  The linked table is know as the RecordSet  An Excel worksheet can also be used as the source for a RecordSet

Displaying Data Fields u To view/alter the contents of the RecordSet, you must associate each field with a data-aware control on the form  A label or textbox can be used as a data-aware control  Data-aware controls have DataSource and DataField properties  To connect a data-aware control to a particular field of the RecordSet  Change DataSource property of the control to the name of a Data Control  Change DataField of the control to name of some field in the RecordSet

Contents of the Student Table

Using RecordSet Methods u Here are some methods that you can use to move the record pointer within the RecordSet (table)  datStudent.RecordSet.MoveFirst  Move to the first record  datStudent.RecordSet.MoveLast  Move to the last record  datStudent.RecordSet.MoveNext  Move to the next record  datStudent.RecordSet.Previous  Move to the previous record u If you use these in button code instead of the arrows on the Data Control, it probably makes sense to make the Data Control invisible

Using RecordSet Methods with Buttons Private Sub cmdFirst_Click() datNavigation.Recordset.MoveFirst End Sub Private Sub cmdNext_Click() datNavigation.Recordset.MoveNext End Sub Private Sub cmdPrev_Click() datNavigation.Recordset.MovePrevious End Sub Private Sub cmdLast_Click() datNavigation.Recordset.MoveLast End Sub