220 likes | 349 Views
Poll: What .NET development language are you using (or plan. [Live Meeting Multiple Choice Poll. Use Live Meeting > Edit Slide Properties... to edit.] Delphi.NET VB.NET C#.NET Other Don't know. using Advantage with ADO.NET. preview. standard ADO.NET data access techniques
E N D
Poll: What .NET development language are you using (or plan ... • [Live Meeting Multiple Choice Poll. Use Live Meeting > Edit Slide Properties... to edit.] • Delphi.NET • VB.NET • C#.NET • Other • Don't know
preview • standard ADO.NET data access techniques • AdsExtendedReader functionality • 4 samples in C#, VB.NET and Delphi.NET • standard components • AdsExtendedReader • seeks • record locking
.net design issues • limit large data reads and writes between client and server. • concurrency issues • data freshness
example #1: classic ADO.NET • AdsConnection: cn.ConnectionString = "data source = ..\\..\\data; servertype = REMOTE |LOCAL"; • AdsCommand SelectCmd = cn.CreateCommand(); SelectCmd.CommandText = "SELECT * FROM websites order by image_name"; da.SelectCommand = SelectCmd; • AdsCommandBuilder cb = new AdsCommandBuilder(da); • AdsDataAdapter da.Fill(ds, "websites");
Poll: Are you developing in .NET now? • [Live Meeting Yes/No Poll. Use Live Meeting > Edit Slide Properties... to edit.] • Yes • No
View/Application Share: example#1: BlobSample_DataSet • [Live Meeting View/Application Share. Use Live Meeting > Edit Slide Properties... to edit.]
DataReader vs. DataSet • use DataReader if -- • do not need to cache data • processing large results too large to fit in memory • need to access data once, in a forward-only and read-only manner • conn.Open(); cmd = conn.CreateCommand(); cmd.CommandText = "select * from departments"; reader = cmd.ExecuteReader(); while ( reader.Read() ) { for ( iField = 0; iField < reader.FieldCount; iField++ ) Console.Write( reader.GetValue(iField) + " "); Console.WriteLine(); }
a better tool • AdsExtendedReader • allows record-level access to server-side data • set filters, set index orders, seek to specific records, lock records, re-index, set bookmarks, zap tables, copy tables, create indexes, read and write to fields, set ranges • bi-directional
Poll: Have you ever used the Advantage .NET Data Provider? • [Live Meeting Yes/No Poll. Use Live Meeting > Edit Slide Properties... to edit.] • Yes • No
example #2: AdsDataAdapter and AdsExtendedReader • Execute AdsExtendedReader: rdr = cmd.ExecuteExtendedReader(CommandBehavior.SequentialAccess) • Set the index order: rdr.ActiveIndex = "Image_PK“ • Seek: rdr.Seek(New Object() {UCase(tbSearch.Text)}, _ seektype).ToString • Read Fields: iFieldNum = rdr.GetOrdinal("Image_File") BLOBData = rdr.GetBytes(iFieldNum)
View/Application Share: example#2: BlobSample_DataReader • [Live Meeting View/Application Share. Use Live Meeting > Edit Slide Properties... to edit.]
example #3: AdsExtendedReader • SeekTypes • SoftSeek: Allows record to be found with the next higher key value if the given key does not exist. • HardSeek: Seeks an exact match. • SeekLast: Seeks for the last value in an index. • SeekGt (Greater Than): Seeks for the last value in the index. • Partial Match • Allows partial matching of seek value. For example, a seek on a last name index with a value of “Smit” would fail to find “Smith” if Partial is false, but succeed if PartialMatch is true.
View/Application Share: example#3: Seek Example • [Live Meeting View/Application Share. Use Live Meeting > Edit Slide Properties... to edit.]
example #4: AdsExtendedReader and record locking • Concurrency issues • Last write wins • Data versioning algorithm • Record Locking rdrEditUser2 := cmdEditUser2.ExecuteExtendedReader; rdrEditUser2.ActiveIndex := 'customer id'; rdrEditUser2.Seek([Int16.Parse(tbCustID.Text)], AdsExtendedReader.SeekType.SoftSeek); rdrEditUser2.LockRecord;
View/Application Share: example#4: Recording Locking • [Live Meeting View/Application Share. Use Live Meeting > Edit Slide Properties... to edit.]
build a better application • install peer-to-peer database by moving a data directory • client application includes 4 DLL’s • free local server DLL • download and install application over internet with no end-user setup. • low maintenance, hands-off install for scalable client-server database • runs as service • no code change required • 5 to 1000 users
summary • Advantage .Net Data Provider • Connection, AdsDataAdapter, DataReader, AdsCommand • AdsExtendedReader • advanced functionality • beyond standard .net data model • distinct advantage • better tools • better design • easy install and maintenance
Advantage Database Server: The Official Guide (ISBN 0-07-223084-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