Datagrid refresh problem 
Author Message
 Datagrid refresh problem

Hi All,

I have programmatically bound a datagrid to an ado recordset. I am
using ADO 2.1.

I assign the datasource property of the control to the recordset object
at run time and run a refresh. This works fine during form load and
displays the data I expect.

My problem is when I run a new report, my recordset gets updated, but
my datagrid doesn't. I generate this report by re-creating the
recordset object with a new query (using the open method), and then
calling the datagrid refresh method, and resetting the datagrid's
datasource.

Here's the killer...
I watch my form do the right thing, ie, I can tell the grid is
displaying the new report, but just for a second. It then REVERTS back
to the original display. I have tried refreshing the form, the control,
and the datagrid. NOTHING works.... except, running the code, line by
line, in BREAK MODE.

Other than installing VB on everyone's computer, and telling them all
how to run code in break mode (note sarcasm), does anyone know how to
fix this? Please don't tell me to refresh the control again!!! It
doesn't work.

By the way, I am using ADO 2.1, VB with SP3, MS Datagrid Control 6.0.
My cursor location is client side, and the recordset is open as a
static, optimistic recordset. (I have tried a few combinations here
also..)

Thanks for any help,

Peter

Sent via Deja.com
http://www.*-*-*.com/



Sat, 12 Jul 2003 17:45:20 GMT  
 Datagrid refresh problem
This sounds familiar. I had a similar experience.
Check your With / EndWith groupings.  If you "With <Object>, and then update
the data within that With / End With area, like this ...

    With Object
        'miscellaneous code
        .update   'call to your database
        'miscellaneous code
    End With

... you can get a kind of parallel universes problem where there are two
copies of your Object floating around, and values inside the With bracket
are different from those outside.

The solution for my mightmare was to "End With" before calling the update,
like this ...

    With Object
        'miscellaneous code
    End With
    Object.update   'call to your database
    With Object
        'miscellaneous code
    End With

Hope that helps. I've been there.
    - Josh


Quote:
> Hi All,

> I have programmatically bound a datagrid to an ado recordset. I am
> using ADO 2.1.

> I assign the datasource property of the control to the recordset object
> at run time and run a refresh. This works fine during form load and
> displays the data I expect.

> My problem is when I run a new report, my recordset gets updated, but
> my datagrid doesn't. I generate this report by re-creating the
> recordset object with a new query (using the open method), and then
> calling the datagrid refresh method, and resetting the datagrid's
> datasource.

> Here's the killer...
> I watch my form do the right thing, ie, I can tell the grid is
> displaying the new report, but just for a second. It then REVERTS back
> to the original display. I have tried refreshing the form, the control,
> and the datagrid. NOTHING works.... except, running the code, line by
> line, in BREAK MODE.

> Other than installing VB on everyone's computer, and telling them all
> how to run code in break mode (note sarcasm), does anyone know how to
> fix this? Please don't tell me to refresh the control again!!! It
> doesn't work.

> By the way, I am using ADO 2.1, VB with SP3, MS Datagrid Control 6.0.
> My cursor location is client side, and the recordset is open as a
> static, optimistic recordset. (I have tried a few combinations here
> also..)

> Thanks for any help,

> Peter

> Sent via Deja.com
> http://www.deja.com/



Sun, 13 Jul 2003 02:17:07 GMT  
 Datagrid refresh problem
Thanks Josh,

unfortuanately I wasnt using WITH statements at all.

Guess what I finally found to work??

I put a messagebox at the end of the program, and hey presto,
everything works. No messagebox, it doesn't work.

Who loves stupid workarounds???

Thanks for the reply!

Peter



Quote:
> This sounds familiar. I had a similar experience.
> Check your With / EndWith groupings.  If you "With <Object>, and then
update
> the data within that With / End With area, like this ...

>     With Object
>         'miscellaneous code
>         .update   'call to your database
>         'miscellaneous code
>     End With

> ... you can get a kind of parallel universes problem where there are
two
> copies of your Object floating around, and values inside the With
bracket
> are different from those outside.

> The solution for my mightmare was to "End With" before calling the
update,
> like this ...

>     With Object
>         'miscellaneous code
>     End With
>     Object.update   'call to your database
>     With Object
>         'miscellaneous code
>     End With

> Hope that helps. I've been there.
>     - Josh



> > Hi All,

> > I have programmatically bound a datagrid to an ado recordset. I am
> > using ADO 2.1.

> > I assign the datasource property of the control to the recordset
object
> > at run time and run a refresh. This works fine during form load and
> > displays the data I expect.

> > My problem is when I run a new report, my recordset gets updated,
but
> > my datagrid doesn't. I generate this report by re-creating the
> > recordset object with a new query (using the open method), and then
> > calling the datagrid refresh method, and resetting the datagrid's
> > datasource.

> > Here's the killer...
> > I watch my form do the right thing, ie, I can tell the grid is
> > displaying the new report, but just for a second. It then REVERTS
back
> > to the original display. I have tried refreshing the form, the
control,
> > and the datagrid. NOTHING works.... except, running the code, line
by
> > line, in BREAK MODE.

> > Other than installing VB on everyone's computer, and telling them
all
> > how to run code in break mode (note sarcasm), does anyone know how
to
> > fix this? Please don't tell me to refresh the control again!!! It
> > doesn't work.

> > By the way, I am using ADO 2.1, VB with SP3, MS Datagrid Control
6.0.
> > My cursor location is client side, and the recordset is open as a
> > static, optimistic recordset. (I have tried a few combinations here
> > also..)

> > Thanks for any help,

> > Peter

> > Sent via Deja.com
> > http://www.deja.com/

--
Peter Owens
Call Centre Analyst
LMT Australia
+613 9611 7403

Sent via Deja.com
http://www.deja.com/



Mon, 14 Jul 2003 07:40:31 GMT  
 Datagrid refresh problem
haha, gotta love microsoft.


Quote:
> Thanks Josh,

> unfortuanately I wasnt using WITH statements at all.

> Guess what I finally found to work??

> I put a messagebox at the end of the program, and hey presto,
> everything works. No messagebox, it doesn't work.

> Who loves stupid workarounds???

> Thanks for the reply!

> Peter



> > This sounds familiar. I had a similar experience.
> > Check your With / EndWith groupings.  If you "With <Object>, and then
> update
> > the data within that With / End With area, like this ...

> >     With Object
> >         'miscellaneous code
> >         .update   'call to your database
> >         'miscellaneous code
> >     End With

> > ... you can get a kind of parallel universes problem where there are
> two
> > copies of your Object floating around, and values inside the With
> bracket
> > are different from those outside.

> > The solution for my mightmare was to "End With" before calling the
> update,
> > like this ...

> >     With Object
> >         'miscellaneous code
> >     End With
> >     Object.update   'call to your database
> >     With Object
> >         'miscellaneous code
> >     End With

> > Hope that helps. I've been there.
> >     - Josh



> > > Hi All,

> > > I have programmatically bound a datagrid to an ado recordset. I am
> > > using ADO 2.1.

> > > I assign the datasource property of the control to the recordset
> object
> > > at run time and run a refresh. This works fine during form load and
> > > displays the data I expect.

> > > My problem is when I run a new report, my recordset gets updated,
> but
> > > my datagrid doesn't. I generate this report by re-creating the
> > > recordset object with a new query (using the open method), and then
> > > calling the datagrid refresh method, and resetting the datagrid's
> > > datasource.

> > > Here's the killer...
> > > I watch my form do the right thing, ie, I can tell the grid is
> > > displaying the new report, but just for a second. It then REVERTS
> back
> > > to the original display. I have tried refreshing the form, the
> control,
> > > and the datagrid. NOTHING works.... except, running the code, line
> by
> > > line, in BREAK MODE.

> > > Other than installing VB on everyone's computer, and telling them
> all
> > > how to run code in break mode (note sarcasm), does anyone know how
> to
> > > fix this? Please don't tell me to refresh the control again!!! It
> > > doesn't work.

> > > By the way, I am using ADO 2.1, VB with SP3, MS Datagrid Control
> 6.0.
> > > My cursor location is client side, and the recordset is open as a
> > > static, optimistic recordset. (I have tried a few combinations here
> > > also..)

> > > Thanks for any help,

> > > Peter

> > > Sent via Deja.com
> > > http://www.deja.com/

> --
> Peter Owens
> Call Centre Analyst
> LMT Australia
> +613 9611 7403

> Sent via Deja.com
> http://www.deja.com/



Wed, 16 Jul 2003 00:06:01 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. DataGrid Refresh Problem - HELP!

2. Datagrid refresh problem

3. DataGrid Refresh Problem

4. DataGrid Refresh Problem (tried some of the suggestions here, but still not working)

5. Datagrid refresh problem

6. DE/Datagrid refreshing problem

7. ADO Datagrid refresh problems

8. Problem: Datagrid Grabs Focus on Timer Refresh

9. Refresh problem DataGrid

10. Datagrid update/refresh problem

11. Problems on Datagrid refresh.

12. Refresh problem with a datagrid control

 

 
Powered by phpBB® Forum Software