Subject Re: Rowset at the end of Set
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Fri, 16 Feb 2024 15:28:58 -0800
Newsgroups dbase.getting-started

On 2/16/2024 10:30 AM, Mustansir Ghor wrote:
> Dear Ken Sir
>
> I am thankful to you for your guidance.
>
> By eliminating possible errors, I left in the form with only ADOQUERY, GRID and Close button that closes the form. when we close the form the alert message still appears.
>
> I have put a dmd procedure in the form that has a connection string and creates temporary table which is been used in the form.
>
> I will appreciate at your convenient time to have a look at my code.
>
> For me I cant trace  the problem.

I think because the grid is dataLinked to the rowset, you're getting a
default behavior, which is probably (but I'm not sure) the rowset
attempting to save the current row, but there is no current row in an
empty table, when the form closes.

I tried checking, in the pushbutton's onClick event handler if simply
setting the query's active property to false would work, but it didn't.
So instead this is what does seem to work:

    function PBCLOSE_onClick1()
       if form.QTEMPSAL.rowset.count() == 0
          form.grid1.dataLink := null
       endif
       form.close()
    return

Ken

--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm