Databases Two - Advanced Programming - Lecture Slides, Slides of Advanced Computer Programming

The advance computer programming may not be a piece of cake for every one, but these slides really help you to understand the concept of the programming.Databases Two, Familiar, Retrieve Database, Dataadapter Classes, Sql Query Statements, Language-Integrated, Expressions, Development, Populate Dataset Objects, Develop Data-Bound

Typology: Slides

2012/2013

Uploaded on 04/30/2013

archa
archa 🇮🇳

4.3

(15)

94 documents

1 / 50

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Working with Databases
C# Programming: From Problem Analysis to Program Design
3rd Edition
14
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32

Partial preview of the text

Download Databases Two - Advanced Programming - Lecture Slides and more Slides Advanced Computer Programming in PDF only on Docsity!

Working with Databases

C# Programming: From Problem Analysis to Program Design 3 rd^ Edition

Part II

Placing DataGridView Control

Figure 14-15 DataGridView control placed on form

Added benefit: DataSet, BindingNavigator, AdapterManager, TableAdapter, and BindingSource objects automatically instantiated

Table dragged from Data Sources window to the form; DataGridView Control created

Component Tray

Customize the DataGridView Object

Use smart tag

Figure 14-16 Customizing the DataGridView control

Formatting DataGridView Cells

Figure 14-19 Formatting DataGridView cells

Customize the DataGridView Object

( continued )

BindingNavigator Control

  • One of the five objects added to the component tray at the bottom of the form when the table from the Data Sources pane is placed on form
  • Provides a standardized way to move through and process the data
  • Much functionality is automatically programmed into the tool strip - Code was also automatically generated

BindingNavigator Control

(continued )

Figure 14-20 BindingNavigator and BindingSource objects

TableAdapterManager

private void studentBindingNavigatorSaveItem_Click (object sender, EventArgs e) { this.Validate( ); this.studentBindingSource.EndEdit( ); this.tableAdapterManager.UpdateAll (this.studentDataBaseDataSet.Student); }

  • UpdateAll( ) method of a TableAdapterManager class
  • TableAdapterManager is extremely useful when an application pulls data from two or more tables - It uses the foreign-key relationships to retrieve and save data in related data tables

TableAdapters

  • Data adapter on steroids
  • TableAdapter’s Update( ) method has to have available SQL Select, Insert, Delete, and Update commands
  • Configure TableAdapter to update data
    • Select the TableAdapter object in component tray to view its properties - TableAdapter has SelectCommand, InsertCommand, UpdateCommand, and DeleteCommand properties - Set the SQL query for the CommandText for these properties
    • Use the DataSet Designer to view and modify CommandText for these properties

Dataset Designer (continued)

Figure 14-21 Dataset Designer opened

TableAdapter object

Reviewing the TableAdapter's

Command Properties

Figure 14-22 Updating the SelectCommand

Clicking in the value box beside the UpdateCommand property reveals New

Query Builder ( continued )

  • First prompted to select the table
  • Can type the SQL statement into the SQL pane or
  • Use the Diagram pane to select columns you want to update
  • Grid pane in the center can be used to filter and enter parameterized expressions
  • Results pane can be used for testing query
    • Located at bottom of the Query Builder

Query Builder ( continued )

Figure 14-23 Identify the Table for the Update