[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

Understanding VsFlexGrid's VirtualData and DataMode properties

(Mike Mitchell)

5/20/2012 7:39:00 AM

VsFlexGrid has a VirtualData property, which when set to True causes
data to only be fetched on demand, permitting much larger recordsets
to be displayed without much of a delay.

However, to do this the DataMode property has to be set to
flexDMBound.

Fine, I thought. No probs. And then I discovered that when set to
flexDMBound, some other properties and methods of the grid are
disabled or restricted. For example, the Sort property is disabled.
You have to change the underlying SQL statement in order to sort on
particular field(s).

So then I tried DataMode = flexDMFree and found that the grid still
accepted the recordset AND I could now use the Sort property!

But now I have my suspicions that using flexDMFree is causing the
VirtualData effect to switch itself off internally, since it is taking
a very long time to display a very large recordset (1.5 million
records) in the grid using this type of data binding.

Has anyone else had experience with VirtualData and very large
recordsets?

As regards the recordset, I have tried various combinations of
CursorType, CursorLocation etc. Plus I've tried setting
ActiveConnection to Nothing etc etc.

MM
6 Answers

Ralph

5/20/2012 9:16:00 AM

0

On Sun, 20 May 2012 08:38:34 +0100, MM <kylix_is@yahoo.co.uk> wrote:

>VsFlexGrid has a VirtualData property, which when set to True causes
>data to only be fetched on demand, permitting much larger recordsets
>to be displayed without much of a delay.
>
>However, to do this the DataMode property has to be set to
>flexDMBound.
>
>Fine, I thought. No probs. And then I discovered that when set to
>flexDMBound, some other properties and methods of the grid are
>disabled or restricted. For example, the Sort property is disabled.
>You have to change the underlying SQL statement in order to sort on
>particular field(s).
>
>So then I tried DataMode = flexDMFree and found that the grid still
>accepted the recordset AND I could now use the Sort property!
>
>But now I have my suspicions that using flexDMFree is causing the
>VirtualData effect to switch itself off internally, since it is taking
>a very long time to display a very large recordset (1.5 million
>records) in the grid using this type of data binding.
>
>Has anyone else had experience with VirtualData and very large
>recordsets?
>
>As regards the recordset, I have tried various combinations of
>CursorType, CursorLocation etc. Plus I've tried setting
>ActiveConnection to Nothing etc etc.
>
>MM


Your suspicions are correct. The VirtualData Property is ignored if
the DataMode property is flexDMFree. (The DataMode property also
disables or modifies the effects of other methods as well.) If you
examine the two DataMode properties you'll see why that is true.

The two approaches and general behavior the control offers in handling
data from an external store, and the trade-offs involved with each
approach, is basic to any data retrieval scheme, and they tend to be
mutually exlusive.

You can either load it all at one time, or maintain a rolling 'view'
or subset of the data and load data in smaller chunks as needed.

If a particular combination of presentation control, data access
library, and database is not meeting requirements you can consider
swapping out some of the elements. Or you might consider writing your
own data store, access library, and control. (Or put it all in one
control.)

But frankly whenever someone asks, "How can I speed up the time it
takes to load data?" - the simplest answer and solution is always
"Load less data".

-ralph

(Mike Mitchell)

5/20/2012 10:33:00 AM

0

On Sun, 20 May 2012 04:16:00 -0500, ralph <nt_consulting64@yahoo.com>
wrote:

>On Sun, 20 May 2012 08:38:34 +0100, MM <kylix_is@yahoo.co.uk> wrote:
>
>>VsFlexGrid has a VirtualData property, which when set to True causes
>>data to only be fetched on demand, permitting much larger recordsets
>>to be displayed without much of a delay.
>>
>>However, to do this the DataMode property has to be set to
>>flexDMBound.
>>
>>Fine, I thought. No probs. And then I discovered that when set to
>>flexDMBound, some other properties and methods of the grid are
>>disabled or restricted. For example, the Sort property is disabled.
>>You have to change the underlying SQL statement in order to sort on
>>particular field(s).
>>
>>So then I tried DataMode = flexDMFree and found that the grid still
>>accepted the recordset AND I could now use the Sort property!
>>
>>But now I have my suspicions that using flexDMFree is causing the
>>VirtualData effect to switch itself off internally, since it is taking
>>a very long time to display a very large recordset (1.5 million
>>records) in the grid using this type of data binding.
>>
>>Has anyone else had experience with VirtualData and very large
>>recordsets?
>>
>>As regards the recordset, I have tried various combinations of
>>CursorType, CursorLocation etc. Plus I've tried setting
>>ActiveConnection to Nothing etc etc.
>>
>>MM
>
>
>Your suspicions are correct. The VirtualData Property is ignored if
>the DataMode property is flexDMFree. (The DataMode property also
>disables or modifies the effects of other methods as well.) If you
>examine the two DataMode properties you'll see why that is true.

I believe you. But as a matter of interest, where/how did you find
this out? I did some Googling and didn't find it mentioned anywhere.
It doesn't say so explicitly in the VideoSoft manual. Sure, it
explains the various side effects of flexDMFree, flexDMBound and
flexDMBoundImmediate, but under VirtualData it just says: "The
VirtualData property is relevant only when the grid is bound to a
recordset." Well, it's still being bound, isn't it, even if I select
flexDMFree? BTW I'm using version 7 of the grid, a version I've had
for over ten years.

>The two approaches and general behavior the control offers in handling
>data from an external store, and the trade-offs involved with each
>approach, is basic to any data retrieval scheme, and they tend to be
>mutually exlusive.
>
>You can either load it all at one time, or maintain a rolling 'view'
>or subset of the data and load data in smaller chunks as needed.
>
>If a particular combination of presentation control, data access
>library, and database is not meeting requirements you can consider
>swapping out some of the elements. Or you might consider writing your
>own data store, access library, and control. (Or put it all in one
>control.)
>
>But frankly whenever someone asks, "How can I speed up the time it
>takes to load data?" - the simplest answer and solution is always
>"Load less data".

Yes, but SOMEtimes I just want an overview of the whole lot. The
VirtualData property (that e.g. MSFlexGrid doesn't have) is great for
that.

MM

Ralph

5/20/2012 6:44:00 PM

0

On Sun, 20 May 2012 11:32:47 +0100, MM <kylix_is@yahoo.co.uk> wrote:

<snipped>
>>
>>
>>Your suspicions are correct. The VirtualData Property is ignored if
>>the DataMode property is flexDMFree. (The DataMode property also
>>disables or modifies the effects of other methods as well.) If you
>>examine the two DataMode properties you'll see why that is true.
>
>I believe you. But as a matter of interest, where/how did you find
>this out? I did some Googling and didn't find it mentioned anywhere.
>It doesn't say so explicitly in the VideoSoft manual. Sure, it
>explains the various side effects of flexDMFree, flexDMBound and
>flexDMBoundImmediate, but under VirtualData it just says: "The
>VirtualData property is relevant only when the grid is bound to a
>recordset." Well, it's still being bound, isn't it, even if I select
>flexDMFree?


In general control terms the expressions "bound" or "unbound" refers
to the location of the control's current store. Whether or not a
control maintains a "synchronous" relationship with the database is an
attribute of a "data-bounded" control.

With VSFlexGrid the traditional form of 'data binding', where the data
is stored, is actually selected by the developer upon his choice of
the initial component to use. Once that is done, as far as VSFlexGrid
is concerned, "bounded" takes on a more specific meaning - what
DataMode is selected - synchronous or non-synchronous.

ie, there is "bound", and then there is "Flex bound". <g>

> <snipped>
>Yes, but SOMEtimes I just want an overview of the whole lot. The
>VirtualData property (that e.g. MSFlexGrid doesn't have) is great for
>that.
>

Not sure what you mean by that. That is, I can't quite equate "loading
smaller chunks of data on an as needed basis" with "providing an
overview of the whole lot", unless you mean the ability to just view
the first few records is providing an "overview".

If better performance and more flexibilty is of interest, you might
consider writing your own data aware classes (storage) and use the
FlexDataSource Property.

-ralph

(Mike Mitchell)

5/21/2012 9:34:00 AM

0

On Sun, 20 May 2012 13:44:22 -0500, ralph <nt_consulting64@yahoo.com>
wrote:

>On Sun, 20 May 2012 11:32:47 +0100, MM <kylix_is@yahoo.co.uk> wrote:
>
><snipped>
>>>
>>>
>>>Your suspicions are correct. The VirtualData Property is ignored if
>>>the DataMode property is flexDMFree. (The DataMode property also
>>>disables or modifies the effects of other methods as well.) If you
>>>examine the two DataMode properties you'll see why that is true.
>>
>>I believe you. But as a matter of interest, where/how did you find
>>this out? I did some Googling and didn't find it mentioned anywhere.
>>It doesn't say so explicitly in the VideoSoft manual. Sure, it
>>explains the various side effects of flexDMFree, flexDMBound and
>>flexDMBoundImmediate, but under VirtualData it just says: "The
>>VirtualData property is relevant only when the grid is bound to a
>>recordset." Well, it's still being bound, isn't it, even if I select
>>flexDMFree?
>
>
>In general control terms the expressions "bound" or "unbound" refers
>to the location of the control's current store. Whether or not a
>control maintains a "synchronous" relationship with the database is an
>attribute of a "data-bounded" control.
>
>With VSFlexGrid the traditional form of 'data binding', where the data
>is stored, is actually selected by the developer upon his choice of
>the initial component to use. Once that is done, as far as VSFlexGrid
>is concerned, "bounded" takes on a more specific meaning - what
>DataMode is selected - synchronous or non-synchronous.
>
>ie, there is "bound", and then there is "Flex bound". <g>
>
>> <snipped>
>>Yes, but SOMEtimes I just want an overview of the whole lot. The
>>VirtualData property (that e.g. MSFlexGrid doesn't have) is great for
>>that.
>>
>
>Not sure what you mean by that. That is, I can't quite equate "loading
>smaller chunks of data on an as needed basis" with "providing an
>overview of the whole lot", unless you mean the ability to just view
>the first few records is providing an "overview".
>
>If better performance and more flexibilty is of interest, you might
>consider writing your own data aware classes (storage) and use the
>FlexDataSource Property.
>
>-ralph

Since my last post I have discovered a few things:

1. The 15 seconds it's taking to show the 1.5 million recordset is
actually made up of 13 secs to Open, i.e. generate, the recordset
(using a simple SQL query, i.e. no sorting, no WHERE clause), plus
only 2 secs for VsFlexGrid to load it! This 2 secs is irrespective of
whether DataMode is set to flexDMBound or flexDMFree.

2. I've tried reducing the time taken to generate the recordset, using
various settings for CursorLocation, CursorType, LockType etc, but it
doggedly remains at +/- 15 secs.

3. When I say I'd like a complete overview sometimes and I see the
VirtualData property as a way to get that, I don't mind if it takes
VsFlexGrid a few 10ths of a sec to move in another bunch of records as
I scroll up or down. But at least it's possible with VsFlexGrid (as
opposed to e.g. MsFlexGrid).

4. Since the time taken by VsFlexGrid to show the initial records is
minimal, even with 1.5 million records in the recordset, what I need
is a way to generate a recordset in stages! That is, Open the
recordset (rs.Open etc etc), but tell ADO to only fetch, say, a 1/4 of
the records. Then at some point the grid or ADO realises I've run out
of road, so the next 1/4 is taken, and so on. This is what I'm now
looking at whether possible and how to do it.

I believe this may be possible using adAsyncFetch, although I do
recall trying using it some years ago and that it didn't work with an
Access mdb.

MM

Schmidt

5/21/2012 10:29:00 AM

0

Am 20.05.2012 09:38, schrieb MM:
> VsFlexGrid has a VirtualData property, which when set to True causes
> data to only be fetched on demand, permitting much larger recordsets
> to be displayed without much of a delay.

Please take a look at the following link to an older
thread, covering that.

>
https://groups.google.com/group/microsoft.public.vb.database/browse_thread/thread/906b3b...

In the last posting (at the bottom) I've posted
a small example for the VSFlex' virtual Mode,
using the IVSFlexDataSource Interface, which you
can use, to bind anything to the VSFlex "virtually"
(VariantArrays, or SQLite-Recordsets as in the example -
or also ADO-Recordsets with no great amount of codechanges).

Olaf

(Mike Mitchell)

5/21/2012 2:36:00 PM

0

On Mon, 21 May 2012 10:33:34 +0100, MM <kylix_is@yahoo.co.uk> wrote:

>On Sun, 20 May 2012 13:44:22 -0500, ralph <nt_consulting64@yahoo.com>
>wrote:
>
>>On Sun, 20 May 2012 11:32:47 +0100, MM <kylix_is@yahoo.co.uk> wrote:
>>
>><snipped>
>>>>
>>>>
>>>>Your suspicions are correct. The VirtualData Property is ignored if
>>>>the DataMode property is flexDMFree. (The DataMode property also
>>>>disables or modifies the effects of other methods as well.) If you
>>>>examine the two DataMode properties you'll see why that is true.
>>>
>>>I believe you. But as a matter of interest, where/how did you find
>>>this out? I did some Googling and didn't find it mentioned anywhere.
>>>It doesn't say so explicitly in the VideoSoft manual. Sure, it
>>>explains the various side effects of flexDMFree, flexDMBound and
>>>flexDMBoundImmediate, but under VirtualData it just says: "The
>>>VirtualData property is relevant only when the grid is bound to a
>>>recordset." Well, it's still being bound, isn't it, even if I select
>>>flexDMFree?
>>
>>
>>In general control terms the expressions "bound" or "unbound" refers
>>to the location of the control's current store. Whether or not a
>>control maintains a "synchronous" relationship with the database is an
>>attribute of a "data-bounded" control.
>>
>>With VSFlexGrid the traditional form of 'data binding', where the data
>>is stored, is actually selected by the developer upon his choice of
>>the initial component to use. Once that is done, as far as VSFlexGrid
>>is concerned, "bounded" takes on a more specific meaning - what
>>DataMode is selected - synchronous or non-synchronous.
>>
>>ie, there is "bound", and then there is "Flex bound". <g>
>>
>>> <snipped>
>>>Yes, but SOMEtimes I just want an overview of the whole lot. The
>>>VirtualData property (that e.g. MSFlexGrid doesn't have) is great for
>>>that.
>>>
>>
>>Not sure what you mean by that. That is, I can't quite equate "loading
>>smaller chunks of data on an as needed basis" with "providing an
>>overview of the whole lot", unless you mean the ability to just view
>>the first few records is providing an "overview".
>>
>>If better performance and more flexibilty is of interest, you might
>>consider writing your own data aware classes (storage) and use the
>>FlexDataSource Property.
>>
>>-ralph
>
>Since my last post I have discovered a few things:
>
>1. The 15 seconds it's taking to show the 1.5 million recordset is
>actually made up of 13 secs to Open, i.e. generate, the recordset
>(using a simple SQL query, i.e. no sorting, no WHERE clause), plus
>only 2 secs for VsFlexGrid to load it! This 2 secs is irrespective of
>whether DataMode is set to flexDMBound or flexDMFree.
>
>2. I've tried reducing the time taken to generate the recordset, using
>various settings for CursorLocation, CursorType, LockType etc, but it
>doggedly remains at +/- 15 secs.
>
>3. When I say I'd like a complete overview sometimes and I see the
>VirtualData property as a way to get that, I don't mind if it takes
>VsFlexGrid a few 10ths of a sec to move in another bunch of records as
>I scroll up or down. But at least it's possible with VsFlexGrid (as
>opposed to e.g. MsFlexGrid).
>
>4. Since the time taken by VsFlexGrid to show the initial records is
>minimal, even with 1.5 million records in the recordset, what I need
>is a way to generate a recordset in stages! That is, Open the
>recordset (rs.Open etc etc), but tell ADO to only fetch, say, a 1/4 of
>the records. Then at some point the grid or ADO realises I've run out
>of road, so the next 1/4 is taken, and so on. This is what I'm now
>looking at whether possible and how to do it.
>
>I believe this may be possible using adAsyncFetch, although I do
>recall trying using it some years ago and that it didn't work with an
>Access mdb.
>
>MM

Further to the above, the following statement reduces the delay down
to 4 secs (from about 15 secs):

rs.Open SQL, Conn, adOpenStatic, adLockOptimistic, adAsyncFetch

It's like magic!

MM