Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

VC++
VC++ Introduction
VC++ What's New
VC++ Supported Platforms
Visual C++ Settings
VC++ Breaking Changes
Visual C++ Walkthroughs
Visual C++ Editions
VC++ Project Templates
Visual C++ Guided Tour
VC++ Creating Command-Line Applications
VC++ Windows Applications
VC++ Reusable Code
VC++ Porting
VC++ Unix Users
VC++ Upgrade Wizard
VC++ Migration Primer
VC++ Managed Types
VC++ Member Declarations
VC++ Conversion Operators
VC++ Interface Member
VC++ Value Types
VC++ Boxed Value
VC++ General Language
VC++ Common Programming
VC++ Database Support
VC++ MFC Database Classes
VC++ Record
VC++ Record View
VC++ OLE DB Programming

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


Data Access in VC++


Previoushome Next






Record (Data Access)

A record is a collection of data about a single entity, such as an account or a customer, stored in a table (a row of the table).
A D V E R T I S E M E N T
A record consists of a group of contiguous columns (sometimes called fields) that contain data of various types. A set of records selected from a data source often called a result set in database terms is called a recordset in MFC. For more information, see Recordset (ODBC).




Schema (Data Access)

A database schema describes the current structure of the tables and database views in the database. In general, wizard-generated code assumes that the schema for the table or tables accessed by a recordset will not change, but the database classes can deal with some schema changes, such as adding, reordering, or deleting unbound columns. If a table changes, you must manually update the recordset for the table, then recompile your application.
You can also supplement the wizard-generated code to deal with a database whose schema is not entirely known at compile time. For more information, see Recordset: Dynamically Binding Data Columns (ODBC).




Catalog Information

Information about the tables in a data source can include the names of tables and the columns in them, table privileges, names of primary and foreign keys, information about predefined queries or stored procedures, information about indexes on tables, and statistics about tables.
For more information, see Data Source: Determining the Schema of the Data Source (ODBC).
Note:
In the MFC DAO classes, you can get catalog information as follows: Use CDaoDatabase::GetTableDefCount and CDaoDatabase::GetTableDefInfo to enumerate the tables in the database and obtain information for each table in a CDaoTableDefInfo structure.




Transactions

The concept of a transaction was developed to handle cases in which the resulting state of the database depends on the total success of a series of operations. This could come about because successive operations might modify the results of previous operations. In such cases, if any one operation fails, the resulting state could be indeterminate.
To solve this problem, transactions group a series of operations in such a way that the integrity of the final result can be assured. Either all the operations must succeed and then be committed (written to the database) or the entire transaction fails. The cancellation of the transaction is called a rollback. Rollback allows a recovery from the changes and returns the database to the pretransaction state.

For example, in an automated banking transaction, if you transfer money from account A to account B, both the withdrawal from A and the deposit to B must succeed to process the funds correctly, or the whole transaction must fail.

A transaction must have ACID properties, which stand for the following:

  • Atomicity A transaction is an atomic unit of work and executes exactly once; either all the work is done or none of it is.
  • Consistency A transaction preserves the consistency of data, transforming one consistent state of data into another consistent state of data. Data bound by a transaction must be semantically preserved.
  • Isolation A transaction is a unit of isolation and each occurs separately and independently of concurrent transactions. A transaction should never see the intermediate stages of another transaction.
  • Durability A transaction is a unit of recovery. If a transaction succeeds, its updates persist, even if the system crashes or is shut down. If a transaction fails, the system remains in the state previous to committing the transaction.

You can support transactions in OLE DB (see Supporting Transactions in OLE DB) or ODBC (see Transaction (ODBC)).

A distributed transaction is a transaction that updates distributed data, that is, data on more than one networked computer system. If you want to support transactions over a distributed system, you should use the Microsoft .NET Framework rather than the OLE DB transaction support.

For information about transactions in the Microsoft .NET Framework, see Processing Transactions in the Windows Software Development Kit (SDK).




Record Views

This section applies only to the MFC ODBC and DAO classes. For information about OLE DB record views, see COleDBRecordView and Using OLE DB Record Views.

To support form-based data-access applications, the class library provides class CRecordView and class CDaoRecordView. A record view is a form view object whose controls are mapped directly to the field data members of a recordset object (and indirectly to the corresponding columns in a query result or table on the data source). Like their base class CFormView, CRecordView and CDaoRecordView are based on a dialog template resource.




Form Uses

Forms are useful for a variety of data-access tasks:

  • Entering data
  • Performing read-only examination of data
  • Updating data



Further Reading About Record Views

The material in topics applies to both the ODBC-based and the DAO-based classes. Use CRecordView for ODBC and CDaoRecordView for DAO.

Topics include:

  • Features of Record View Classes
  • Data Exchange for Record Views
  • Your Role in Working with a Record View
  • Designing and Creating a Record View
  • Using a Record View



Features of Record View Classes


You can do form-based data-access programming with class CFormView, but CRecordView and CDaoRecordView are generally better classes to derive from. In addition to their CFormView features, CRecordView and CDaoRecordView:
  • Provide dialog data exchange (DDX) between the form controls and the associated recordset object.
  • Handle Move First, Move Next, Move Previous, and Move Last commands for navigating through the records in the associated recordset object.
  • Update changes to the current record when the user moves to another record.

For more information about navigation, see Record Views: Supporting Navigation in a Record View.




Data Exchange for Record Views

When you use Add Class to map the controls in a record view's dialog template resource to the fields of a recordset, the framework manages data exchange in both directions from recordset to controls and from controls to recordset. Using the DDX mechanism means that you do not have to write the code to transfer data back and forth yourself.
DDX for record views works in conjunction with:
  • RFX for recordsets of class CRecordset (ODBC).
  • DFX for recordsets of class CDaoRecordset (DAO).

Although they differ in implementation, at the interface level RFX and DFX are very similar data exchange mechanisms. The DAO version, DFX, is modeled closely on the earlier ODBC version, RFX. If you know how to use RFX, you know how to use DFX.

RFX and DFX move data between the current record of the data source and the field data members of a recordset object. DDX moves the data from the field data members to the controls in the form. This combination fills the form controls initially and as the user moves from record to record. It can also move updated data back to the recordset and then to the data source.

The following figure shows the relationship between DDX and RFX (or DFX) for record views.

Dialog Data Exchange and Record Field Exchange

For more information about DDX, see Dialog Data Exchange and Validation. For more information about RFX, see Record Field Exchange (RFX).




Your Role in Working with a Record View

The following table shows what you typically must do to work with a record view and what the framework does for you.
Working with a Record View: You and the Framework
You The framework
Use the Visual C++ Dialog editor to design the form. Creates a dialog template resource with controls.
Use the MFC Application Wizard to create classes derived from CRecordView and CRecordset or from CDaoRecordView and CDaoRecordset. Writes the classes for you.
Map record view controls to recordset field data members. Provides DDX between the controls and the recordset fields.
Provides default command handlers for Move First, Move Last, Move Next, and Move Previous commands from menus or toolbar buttons.
Updates changes to the data source.
[Optional] Write code to fill list boxes or combo boxes or other controls with data from a second recordset.
[Optional] Write code for any special validations.
[Optional] Write code to add or delete records.

Form-based programming is only one approach to working with a database. For information about applications using some other user interface, or no user interface, see MFC: Using Database Classes with Documents and Views and MFC: Using Database Classes Without Documents and Views. For alternative approaches to displaying database records, see classes CListView and CTreeView.




Designing and Creating a Record View

You can create your record view class with the MFC Application Wizard. If you use an application wizard, it creates the record view class and a dialog template resource for it (without controls). You must use the Visual C++ Dialog editor to add controls to the dialog template resource. On the other hand, if you use Add Class, you must first create the dialog template resource in the Dialog editor and then create the record view class.

This information applies to both CRecordView and CDaoRecordView.

To create your record view with the MFC Application Wizard

  • See Database Support, MFC Application Wizard.

To design your form

  • See Dialog Editor.

To create your record view class

  • See Adding an MFC ODBC Consumer.

The following topics explain additional details of using record views:

  • Record Views: Supporting Navigation in a Record View
  • Record Views: Using a Record View
  • Record Views: Filling a List Box from a Second Recordset




Supporting Navigation in a Record View

This topic explains how to support movement from record to record in your record view, including information about:
  • Command handling for record scrolling commands.
  • User-interface update handlers for scrolling commands.

The information in these topics applies to both CRecordView (ODBC) and CDaoRecordView (DAO).




Command Handlers for Record Scrolling

Classes CRecordView and CDaoRecordView provide default command handling for the following standard commands:
  • ID_RECORD_MOVE_FIRST
  • ID_RECORD_MOVE_LAST
  • ID_RECORD_MOVE_NEXT
  • ID_RECORD_MOVE_PREV

The OnMove member function of classes CRecordView and CDaoRecordView provides default command handling for all four commands, which move from record to record. As these commands are issued, RFX (or DFX) loads the new record into the recordset's fields and DDX moves the values into the record form's controls. For information about RFX, see Record Field Exchange (RFX).

Note:
Be sure to use these standard command IDs for any user-interface objects associated with the standard record navigation commands.




User-Interface Updating for Record Views

CRecordView and CDaoRecordView also provide default user-interface update handlers for the navigation commands. These handlers automate enabling and disabling the user-interface objects menu items and toolbar buttons. The application wizard supplies standard menus and, if you choose the Dockable Toolbar option, a set of toolbar buttons for the commands. If you create a record view class using CRecordView, you might want to add similar user-interface objects to your application.

To create menu resources with the menu editor

  • Referring to the information about using the menu editor, create your own menu with the same four commands.

To create toolbar buttons with the graphics editor

  • Referring to the information about using the toolbar editor, edit the toolbar resource to add toolbar buttons for your record navigation commands.



Be the first one to comment on this page.




  VC++ eBooks

No eBooks on VC++ could be found as of now.

 
 VC++ FAQs
More Links » »
 
 VC++ Interview Questions
More Links » »
 
 VC++ Articles
More Links » »
 
 VC++ News
More Links » »
 
 VC++ Jobs
More Links » »

Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: bsd programming language, bsd language programming tutorial pdf, history of bsd programming, basic bsd programming, bsd band satellite programming, syntax use in bsd programming, bsd programming software download, turbo bsd programming, bsd programming code, learn bsd programming

HTML Quizzes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizzes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World
Copyright 2003-2017 Vyom Technosoft Pvt. Ltd., All Rights Reserved.