wayne plourde

software architect mcad mcsd scjp

home | articles | book | resume | projects | contact

15 - Advanced Features of ADO 2.5 (Outline and Notes)

ASP 3.0 The Complete Reference

Chapter 15

Advanced Features of ADO 2.5 (Outline and Notes)

Persisting Recordsets

Getting Data about Data Schema retrieval and manipulation

Hierachical Data

Data Shapes

Stored Procedures

Avoid stored procedures with the Exec statements requires a parsing always us e the RPC method

when to use Stored Procedures

best for when you dont need recordsets

confirmation like login validation

manipulating

Dont use prepared if you are only calling the command once.

VBScript

1

2

3

4

5

6

7

8

9

10

Avoid procedures that require a recompile -

Limnit access to temp tables to those created in same procedures

Dont Drop Temp Table at end of Stored Proceduire

Do Not Decalre a cursor ofver a Temp Table

Prepare and Execute

VBScript

1

2

3

4

5

6

7

8

9

10

Using the Command Object

VBScript

1

2

3

4

5

6

7

8

9

10

Parameters

In

Out

Return Values

Parameters may be order dependent (check this)

Refresh

Parameter queries with access

Replaces old RDO functionality.

also use sys columns to retrieve parameters and data types

Creating Wrapper functions for Stored Procedures

Working with disconnected record sets

Not terribly useful on the server unless you plan to place recordsets into session or application context

See threading issues

Using the Client Cursor Location

(replaces old RDO functionality)

VBScript

1

2

3

4

5

6

7

8

9

10

Resyncing Data

VBScript

1

2

3

4

5

6

7

8

9

10

Checking Underlying Values

Only available after Resync is called

Requires a unique table to retrieve underlying Values

Collect bookmarks for records that have changed

Using Asynchronous Requests

Generally not necessary, since ASP scripts are sequential.

However, with client cursor, allows data diplay to begin before the entire data set is read

AsynchFetch will block until first request is fulfilled

VBScript

1

2

3

4

5

6

7

8

9

10

Filter, Sort, Seek, Find

Setting a fields Optimize Property

client side cursors only

creates an index on the field

VBScript

1

2

3

4

5

6

7

8

9

10

Filtering a Recordset

bookmarks

VBScript

1

2

3

4

5

6

7

8

9

10

Sorting a recordset

VBScript

1

2

3

4

5

6

7

8

9

10

Seek and Find

VBScript

1

2

3

4

5

6

7

8

9

10

Creating Connectionless Recordsets

Building a Recordset from Scratch

VBScript

1

2

3

4

5

6

7

8

9

10

Using ADO Components in Free Threaded Mode

Refer to Chapter XX Component Basics

Threading is the technology that enables the middle tier running on the Web server to communicate to other components in one or multiple threads. The threading model chosen can greatly affect performance. For example, if you have the option of communicating through one thread or multiple threads to the server hosting our data, you can provide support for multiple customers simultaneously by using multiple threads.

Free-Threading and ADO Objects

By default, all ADO objects are marked in the registry as apartment-threading model. If caching of ADO objects off the Application or Session object is required, you must mark the affected object as free-threaded. To mark the ADO objects as free-threaded in the registry, you'll need to regedit the adofre15.reg file. Here's how to do this:

Locate the ADOFre15.reg file. If you accepted the defaults for program file location when installing IIS, the ADOFre15.reg file will be in c: \Program files\Common files\System\ADO.

Make the directory containing the file your current directory and issue the RegEdit ADOFre15.reg command.

You will need to restart your server before the change will take effect.

If you determine you need to switch the ADO threading model back to apartment threading, follow the above instructions, but RegEdit the ADOApt15.reg file.

Note that sharing an ADO Connection object across multiple threads will not necessarily increase performance, and could potentially be slower. If the provider supports connection pooling (as does the SQL Server ODBC 3.5 driver), this is a more efficient mechanism. Also, when leaving a cached connection open between operations, it could possibly be dropped or the link to the server could be broken.

Saving Recordsets to a File

Quick overview of the Save() feature of recordsets

More examples in Chapter 14

Persistence

Recordset.save()

discuss parameters

Specify the persistence provider

ATDG or XML

File or Stream object

Save File with Session ID use cleanup in Session_onEnd

VBScript

1

2

3

4

5

6

7

8

9

10

Save to a file

VBScript

1

2

3

4

5

6

7

8

9

10

Read from a File

Doesnt work with Free Threaded on Access

Viewing and Manipulating Database Schema

allows you to consistent queries about DDL without specific knowledge of the data source

Why do you need this

Raises your ability to build a flexible infrastructure

SQL Server System Tables

Tables List

Views List

Extracting Data

Executing DDL statements

Execute CREATE and ALTER Statements

OpenSchema

Example

Adding a list of tables to our data grid

Consistent across providers

Figure 1: Screen Shot of Grid with Table List

VBScript

1

2

3

4

5

6

7

8

9

10

on connection object

Provides a result set wi