Re: Requery('viewname')



Sorry about the omission. Now that we know the error, we can fix your
problem.

Before you create your connection, run the following code. It only needs to
be run ONCE and usually at the beginning of your MAIN prg, sometime other
time during the startup of your app, or at the beginning of your "connection
manager class" if you have one.

SQLSETPROP(0, 'asynchronous', .f.)

Outside of your app, you can paste the following code in a temporary PRG
file or a generic utility PRG file and run it. This will "correct" your
views so they have the following properties:

ADBOBJECTS(laViews, 'VIEW')
FOR EACH lcView IN laViews
DBSETPROP(lcView,'VIEW','AllowSimultaneousFetch',.F.)
DBSETPROP(lcView,'VIEW','FetchAsNeeded',.F.)
DBSETPROP(lcView,'VIEW','FetchSize',-1)
DBSETPROP(lcView,'VIEW','MaxRecords',-1)
DBSETPROP(lcView,'VIEW','ShareConnection',.T.) && optional
ENDFOR

The main property to set for the connection busy is the FetchSize.

"Eric Lim" <EricLim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DFE95F61-B31D-4AFB-BA21-8786DD17C68B@xxxxxxxxxxxxxxxx
> Hi All,
>
> Thank you Dan for identifying the omission. Mark's idea of capturing the
> error code have some result. This is what I got and as expected
'Connection
> is busy'
>
> Clipboard text:-
> 1526
> Connectivity error: [Microsoft][ODBC SQL Server Driver]Connection is busy
> with results for another hstmt
> [Microsoft][ODBC SQL Server Driver]Connection is busy with results for
> another hstmt
> S1000
> 0
> 6
>
> I am puzzled by why VFP did not identified return value -1 for REQUERY()
to
> developer so at least we understand how to handle it in our coding. Most
> likely VFP team did not expect return value -1, otherwise it should
> documented in the user guide. The solution I suppose is not to use shared
> connection but then you will need to create a new connection to SQL
server.
>
> There is one unclear issue here is when you create a new connection, do we
> use SQLCOMMIT() twice since there are two connections in the same private
> datasession or just one SQLCOMMIT is fine? As you are aware SQLCOMMIT() is
> via statement handle since VFP8.
>
>
>
> "Mark McCasland" wrote:
>
> > Modify your code to the following:
> >
> > lnReturn = REQUERY('view_name')
> > if lnReturn < 0 and version (2) = 2 && dev environment
> > local laError[1], lcError, lnI
> > aerror(laError)
> > lcError = []
> > for lnI = 1 to alen(laError)
> > lcError = transform(laError[lnI]) + CHR(13) + CHR(10)
> > endfor
> > messagebox(lcError)
> > _cliptext = lcError
> > endif
> >
> > Since the error info will now be on the clipboard, come back here and
post
> > the error info so we can try to see what is happening.
> >
> > "Eric Lim" <EricLim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:D9EFB721-8BD9-4E9A-8F3A-0D8CB01F1BE5@xxxxxxxxxxxxxxxx
> > > Hi,
> > >
> > > Let me update you further on this. With regards to Modal form, it does
> > > happens but only when you do a REQUERY() in a very fast way. What I
have
> > here
> > > is master records with three child tables so if I change the record
> > position
> > > in the master table the child records with be REQUERY() accordingly.
> > >
> > > Thus if I change the master record in a split second the REQUERY()
will
> > > return -1 too although not as obvious as Modeless form.
> > >
> > >
> > > "Mark McCasland" wrote:
> > >
> > > > Does the SELECT command used to create the view have any functions
like
> > > > TRIM() for any of the fields being selected? If so, the problem
could be
> > a
> > > > "base table structure change" type of error. Does AERROR() return
any
> > more
> > > > information?
> > > >
> > > > "Eric Lim" <EricLim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > > news:97595292-0285-497B-8EBA-8CE09F1A5628@xxxxxxxxxxxxxxxx
> > > > > Hi All,
> > > > >
> > > > > Any idea what is the problem if the Requery() returns -1 instead
of 0
> > or
> > > > 1?
> > > > > There is no documentation to explain what was the problem if
Requery()
> > > > return
> > > > > -1
> > > > >
> > > > > --
> > > > > Eric Lim
> > > >
> > > >
> > > >
> >
> >
> >


.



Relevant Pages

  • Re: Requery(viewname)
    ... error code have some result. ... I am puzzled by why VFP did not identified return value -1 for REQUERY() to ... connection but then you will need to create a new connection to SQL server. ... >> is master records with three child tables so if I change the record ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Refresh DB
    ... connection than closing and opening it? ... you can use Requery, which is the same as if you would call Close and ...
    (borland.public.delphi.database.ado)
  • ADP Change Connection - Refresh Switchboard
    ... I have a switchboard form with a text box whose data source is ... I would like the form to requery and display new connection info in the ...
    (microsoft.public.access.formscoding)
  • Re: ADP Change Connection - Refresh Switchboard
    ... > Alan Z. Scharf wrote: ... I would like the form to requery and display new connection info in ... >> textbox when I change the connection with File, ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Palestine during/around Jesus time
    ... connection and still today believers do the same thing. ... Egyptian rule. ... logic....or logic with omission. ...
    (soc.history.ancient)