ComponentOne True DataControl 8.0
SourceConnection Property

 

SourceConnection Property

Sets/returns the ADO connection used to connect to underlying data in data source mode.

Syntax

TData.SourceConnection

Remarks

Read/Write at run time. Not available at design time. Property applies to TData control.

This property can be used to optimize database resource consumption in DataMode = 0 - DataSource when the default connection pooling does not apply. It is a run-time only property, with read/write access. You can set this property to an ADO Connection object created in code. Then TData will use that connection object when it creates its SourceRecordset.

You can create a single Connection object (or several such objects) in code and assign it to each TData's SourceConnection property. Then they will all share the same database connection.

As with SourceRecordset, there are two possible ways to set the SourceConnection property:

·      You can set it in OpenData event, or

·      You can set it from code outside of any TData events. In this case, setting SourceConnection will trigger immediate refresh unless you enclose it in TData.ChangeInProgress=True/False.

If you set SourceConnection and don't set SourceRecordset, TData will create SourceRecordset based on its current data source property settings, using the Connection object you specified.

If you set SourceRecordset in your code, then don't set SourceConnection. There is no need for that since a recordset you created in code is already attached to a specific connection.

See Also

TData Control

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback