View the PowerPoint presentation

Download Report

Transcript View the PowerPoint presentation

Advantage .NET Data Provider
agenda
• ADO.NET Overview
• Advantage .NET Data Provider
• Advantage Specific Functionality
ADO.NET architecture
ADO.NET objects
• Connection – Connects to the data source
• DataAdapter – Connects through
OConnection and populates DataSet
• Command – Executes SQL or stored
procedures against datasource
• DataReader – Provides read-only
connections to datastore
data adapter
• Data Adapter fills DataSet by using built-in
Command Objects
– SelectCommand
– DeleteCommand
– UpdateCommand
– InsertCommand
• Data Adapter’s update method flushes
changes to datasource via Delete, Update
and Insert Commands
data reader
• DataReader object automatically holds results
from a Data Command
• DataReader object returns a read-only, forwardonly stream of data from a DataCommand. Only
a single row of data is in-memory at a time.
dataset architecture
dataset
• Miniature Database
– Made up of tables and relationships between
tables
– Set up constraints and referential integrity
• DataSets are disconnected
– Other users may change underlying data
– DataSets have no recognition of changes
datatable
• A single table within a dataset
• Contains all table data and schema
• Constraint collection
– Foreign Key
– Unique
Advantage .NET Data Provider
connection string
• Free table connection
AdsConnection conn = new AdsConnection(
"data source=C:\\data;ServerType=remote
|local; TableType=ADT" );
• Data Dictionary connection
AdsConnection conn = new AdsConnection(
"data source=C:\\data\mydictionary.add
;ServerType=remote|local;User ID=chrisf
;Password=password");
• Reminder: ADSSYS account for data
dictionary Administration only
Advantage specific options
•
•
•
•
•
•
•
•
Server Type
Table Type
Encryption Password
TrimTrailingSpaces
Compression
CharType
LockMode
SecurityMode
quick start*
• Add a reference to Advantage.Data.Provider
• Specify the name space
using Advantage.Data.Provider; ( C# )
Imports Advantage.Data.Provider ( VB.NET )
•
•
•
•
Define the connection string
Create an AdsDataAdapter
Create a DataSource
Bind controls to the DataSource
Advantage data adapter wizard*
• Added with version 7.0.1
• Creates all the required objects
– Connection
– DataAdapter
– SQL Commands
• Allows for data preview
Dealing With Concurrency
• Last in Wins
– Ok if reading one record at a time
– Not for sensitive Inventory/Ticket applications
• Version Number Approach
– UPDATE Table1 Set Column1 = @newvalue1, Column2 =
@newvalue2 WHERE RowVersion = @origRowVersionValue
• Saving All Values Approach
– UPDATE Customers SET CustomerID = @currCustomerID,
CompanyName = @currCompanyName WHERE ( CustomerID =
@ origCustomerID ) AND ( CompanyName =
@origCompanyName OR @origCompanyName IS NULL and
CompanyName IS NULL )
Advantage Specific Functionality
Adsconnection*
•
•
•
•
•
•
•
Connection Timeout
Database
Dictionary Version
Is Dictionary Connection
Server Name
Server Time
Server Type
AdsExtendedDataReader
•
•
•
•
•
•
•
Filters
Index Support
Record Number
Ranges
Table Encryption
Record Locking
Copying Tables
locating records*
• Seek Types
– Soft Seek
– Hard Seek
– Seek Last
– Seek GT
• Seek syntax
Reader.Seek( New Object { <value> }, SeekType )
Borland Data Provider
• The Borland Data Provider (BDP) is a new
data access method available in C# Builder
and Delphi 8
• Requires Delphi 8 General Update 2
• Add Advantage information to
bdpDataSources.xml for use in the IDE
summary
• ADO.NET
• Advantage Data Provider
– Advantage Connection
– Advantage DataAdapter
– Advantage DataReader
– Advantage ExtendedDataReader
• Borland Data Provider
Questions ? ? ?
Advantage Database Server: The Official Guide (ISBN 0-07223084-3) is a new book, written by Cary Jensen and Loy
Anderson and published by McGraw-Hill/Osborne Media
Group, that systematically guides a developer through key
functionality of Advantage and includes a Companion CD with
code samples and a single-user license of Advantage
Database Server version 7.0.
http://www.extendedsystems.com/ADS/ADS+Book+Promo.htm