Introduction to Database Development Using Borland Data Providers 2128 Martin Rudy.

30
Introduction to Database Development Using Borland Data Providers 2128 Martin Rudy

Transcript of Introduction to Database Development Using Borland Data Providers 2128 Martin Rudy.

Introduction to Database Development Using

Borland Data Providers

2128

Martin Rudy

Agenda

– BDP Architecture Overview– BDP Components– Connection to data– Using the Data Explorer– Updating data / Transactions– Master / Detail– Dynamic Queries– Migrating to BDP– Data resolving

Additional BDP Sessions

Mon

2186 Building Database Applications with ADO.NET

3188 ASP.NET Web Forms and Databases

Tue

2106 The ADO.NET DataSet In-depth

Wed

4100 Integrating into the Borland Data Provider

3188 ASP.NET Web Forms and Databases

3116 Top 10 Techniques for Microsoft .NET DB Dev

BDP Architecture Overview

– Implementation for ADO.NET Data Provider interfaces

– Includes set of component designers– Live data– Adds following extensions:

• metadata retrival• schema creation

Supported Databases

– ORACLE 9.1.2, 8.1.5– Microsoft SQL Server 2000– MSDE– Access – InterBase 7.x– Sybase 12.5

BDP Components

DataSet

New in Diamondback

– BdpCopyTable• Copy table data and PK

– Data Resolving• DataHub• DataSync

– Data Remoting• RemoteConnection• RemoteServer

Connecting to data

– Place a BdpConnection component– Set connection parameters– Place a BdpDataAdapter and define

SQL statements– Create a dataset– Activate BdpDataAdapter– Place a data aware control and

connection to dataset

Code DemoConnecting to data

Using the Data Explorer

– Tool to browse databases

– Establish named connections

– Display table schemas, stored procs, views

– Modify data – update and rollback option

– Alter, drop, copy, paste table

– SQL Window

– Data migration

– Available outside IDE

Code DemoUsing the Data Explorer

Data updating basics

– Two BdpDataAdapter methods:• Update• AutoUpdate

– BdpCommandBuilder• Developer handled updates

Code DemoData updating basics

Column Properties

– Properties for each column– Like TField properties– Use Tables property on DataSet– Displays Table Collections Editor– Select Columns property– Display Columns Collections Editor

Code DemoColumn Properties

Transactions

– BdpTransaction• Commit• Rollback

– Create instance of BdpTransaction– BeginTransaction from connection

Code DemoTransactions

Master / Detail

– Need two BdpDataAdapter components– Create SQL for master and detail– Populate same dataset– Activate both adapters– Modify dataset Relations property

• Use Relations Collection Editor• Define Parent and Child tables

– Detail DataMember property use relationship name

Code DemoMaster / Detail

Dynamic Queries

– Specify SQL in BdpDataAdapter– Use ? for parameter place holder– Modify BdpDataDataAdaper

SelectCommand property– Use Parameters property to display

BdpParameter CollectionEditor to define parameters

– Assign parameter value as follows:BdpSelectCommand1.Parameters['cntry'].Value

Code DemoDynamic Queries

Migrating to BDPComponents

Connection BdpConnection

DataSetProvider (DSP) BdpDataAdapterBdpDataHub/BdpDataSync

ClientDataSet (CDS) DataSet

TransDesc, IBTransaction BdpTransaction

Migrating to BDPEvents

DSP.BeforeUpdateRecordDSP.AfterUpdateRecord

BdpDataAdapter.RowUpdatingBdpDataAdapter.RowUpdated

DataSet.BeforePostDataSet.AfterPost

DataSet.Tables RowChangingDataSet.Tables RowChanged

DataSet.BeforeDeleteDataSet.AfterDelete

DataSet.Tables RowDeletingDataSet.Tables RowDeleted

TField.OnValidate DataSet.Tables ColumnChangingDataSet.Tables ColumnChanged

Migrating to BDPMethods

CDS.ApplyUpdates BdpDataAdapter.AutoUpdate

CDS.Delta DataSet/Tables GetChanges

CDS.CancelUpdates DataSet/Tables RejectChanges

CDS.ChangeCount > 0 DataSet.HasChanges

CDS.CloneCursor DataSet/Tables Clone

CDS.EmptyDataSet DataSet/Tables Clear

CDS.LoadFromFile(xml) DataSet.ReadXml

CDS.WriteToFile(xml) DataSet.WriteXml

CDS.MergeChangeLog DataSet/Tables AcceptChanges

Migration to BDPProperties

DSP.UpdateMode BdpUpdateMode (All, Key, Changed)

DataSet.State DataSet.Tables Rows RowState

EOF/BOF None – need to use DataRow

TField properties DataSet ColumnCollection

Code DemoMigrating to BDP

Data Resolving

– DataHub• Client side cache for DataSet • From any IDataProvider

– DataSync• holds a collection of DataProviders• BDP and non-BDP• Optimal SQL generation for BDP • Uses CommandBuilder for non BDP providers

– Similar to TDataSetProvider• Error dataset not returned• Integrated into dataset

Introduction to Database Development Using

Borland Data Providers

Martin Rudy

2128

Q & A