Hi,

VFP9, Win XP Pro SP2

The following code in a class causes frequent but inconsistent crashes - it
may work several times and then crash - the error is fatal error: exception
code C00..005 with a reference to the last line of the SQL statement.

I have restarted, turned the PC off and on, cleaned up the class, copied the
code to a new method and tried a few work arounds (the original code is
commented out).

Any suggestions as to what else to try would be great.

John Pugh
Adelaide, South Australia
LPARAMETERS tn_id_emp,tc_filter &&, tn_Data_Session

CASE EMPTY(tn_id_emp) &&OR EMPTY(tn_Data_Session)

WAIT WINDOW 'Both parameters must be passed to main.calc_tax'

RETURN

ENDCASE

*SET DATASESSION TO tn_Data_Session

* Calculate the component for the passed params

LOCAL lc_filter,lc_tab_fld,ln_amount

* Build the name of the table.field to test

lc_tab_fld='pay_cats.'+tc_filter

* Calculate the amount

lc_filter= 'WHERE pay_line.id_emp=tn_id_emp'

lc_filter=lc_filter+' AND pay_line.id_pay_ref=params_pay.id_pay_ref'

lc_filter=lc_filter+' AND '+lc_tab_fld+' = .T. '

* See if the following stops it crashing...

SELECT pay_line.amount;

FROM pay_line ;

JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;

JOIN pay_cats ON pay_cats.id_key=pay_cats_e.id_pay_cat ;

&lc_filter ;

INTO CURSOR cur_tran_calc


SUM cur_tran_calc.amount TO ln_amount

* The following kept crashing so the filter was built

*!* SELECT SUM(pay_line.amount) AS amount;

*!* FROM pay_line ;

*!* JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;

*!* JOIN pay_cats ON pay_cats_e.id_pay_cat=pay_cats.id_key;

*!* WHERE pay_line.id_emp=tn_id_emp;

*!* AND pay_line.id_pay_ref=params_pay.id_pay_ref;

*!* AND &lc_tab_fld = .T. ;

*!* INTO CURSOR cur_temp nofilter

Re: VFP9 keeps crashing - any suggestions by Rick

Rick
Tue Nov 29 09:11:15 CST 2005

John,
If this code is really cut and pasted, then try adding a space before the ; in
the line:

JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key ;

Rick

"John Pugh" <notreal@xyx.com.zz> wrote in message
news:438c0311@dnews.tpgi.com.au...
> Hi,
>
> VFP9, Win XP Pro SP2
>
> The following code in a class causes frequent but inconsistent crashes - it
> may work several times and then crash - the error is fatal error: exception
> code C00..005 with a reference to the last line of the SQL statement.
>
> I have restarted, turned the PC off and on, cleaned up the class, copied the
> code to a new method and tried a few work arounds (the original code is
> commented out).
>
> Any suggestions as to what else to try would be great.
>
> John Pugh
> Adelaide, South Australia
> LPARAMETERS tn_id_emp,tc_filter &&, tn_Data_Session
>
> CASE EMPTY(tn_id_emp) &&OR EMPTY(tn_Data_Session)
>
> WAIT WINDOW 'Both parameters must be passed to main.calc_tax'
>
> RETURN
>
> ENDCASE
>
> *SET DATASESSION TO tn_Data_Session
>
> * Calculate the component for the passed params
>
> LOCAL lc_filter,lc_tab_fld,ln_amount
>
> * Build the name of the table.field to test
>
> lc_tab_fld='pay_cats.'+tc_filter
>
> * Calculate the amount
>
> lc_filter= 'WHERE pay_line.id_emp=tn_id_emp'
>
> lc_filter=lc_filter+' AND pay_line.id_pay_ref=params_pay.id_pay_ref'
>
> lc_filter=lc_filter+' AND '+lc_tab_fld+' = .T. '
>
> * See if the following stops it crashing...
>
> SELECT pay_line.amount;
>
> FROM pay_line ;
>
> JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>
> JOIN pay_cats ON pay_cats.id_key=pay_cats_e.id_pay_cat ;
>
> &lc_filter ;
>
> INTO CURSOR cur_tran_calc
>
>
> SUM cur_tran_calc.amount TO ln_amount
>
> * The following kept crashing so the filter was built
>
> *!* SELECT SUM(pay_line.amount) AS amount;
>
> *!* FROM pay_line ;
>
> *!* JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>
> *!* JOIN pay_cats ON pay_cats_e.id_pay_cat=pay_cats.id_key;
>
> *!* WHERE pay_line.id_emp=tn_id_emp;
>
> *!* AND pay_line.id_pay_ref=params_pay.id_pay_ref;
>
> *!* AND &lc_tab_fld = .T. ;
>
> *!* INTO CURSOR cur_temp nofilter
>
>


Re: VFP9 keeps crashing - any suggestions by Dan

Dan
Tue Nov 29 11:14:54 CST 2005

In addition to Fred's suggestion, you're missing a DO CASE at the top of the
method.

Dan

John Pugh wrote:
> Hi,
>
> VFP9, Win XP Pro SP2
>
> The following code in a class causes frequent but inconsistent
> crashes - it may work several times and then crash - the error is
> fatal error: exception code C00..005 with a reference to the last
> line of the SQL statement.
>
> I have restarted, turned the PC off and on, cleaned up the class,
> copied the code to a new method and tried a few work arounds (the
> original code is commented out).
>
> Any suggestions as to what else to try would be great.
>
> John Pugh
> Adelaide, South Australia
> LPARAMETERS tn_id_emp,tc_filter &&, tn_Data_Session
>
> CASE EMPTY(tn_id_emp) &&OR EMPTY(tn_Data_Session)
>
> WAIT WINDOW 'Both parameters must be passed to main.calc_tax'
>
> RETURN
>
> ENDCASE
>
> *SET DATASESSION TO tn_Data_Session
>
> * Calculate the component for the passed params
>
> LOCAL lc_filter,lc_tab_fld,ln_amount
>
> * Build the name of the table.field to test
>
> lc_tab_fld='pay_cats.'+tc_filter
>
> * Calculate the amount
>
> lc_filter= 'WHERE pay_line.id_emp=tn_id_emp'
>
> lc_filter=lc_filter+' AND pay_line.id_pay_ref=params_pay.id_pay_ref'
>
> lc_filter=lc_filter+' AND '+lc_tab_fld+' = .T. '
>
> * See if the following stops it crashing...
>
> SELECT pay_line.amount;
>
> FROM pay_line ;
>
> JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>
> JOIN pay_cats ON pay_cats.id_key=pay_cats_e.id_pay_cat ;
>
> &lc_filter ;
>
> INTO CURSOR cur_tran_calc
>
>
> SUM cur_tran_calc.amount TO ln_amount
>
> * The following kept crashing so the filter was built
>
> *!* SELECT SUM(pay_line.amount) AS amount;
>
> *!* FROM pay_line ;
>
> *!* JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>
> *!* JOIN pay_cats ON pay_cats_e.id_pay_cat=pay_cats.id_key;
>
> *!* WHERE pay_line.id_emp=tn_id_emp;
>
> *!* AND pay_line.id_pay_ref=params_pay.id_pay_ref;
>
> *!* AND &lc_tab_fld = .T. ;
>
> *!* INTO CURSOR cur_temp nofilter



Re: VFP9 keeps crashing - any suggestions by Rick

Rick
Tue Nov 29 12:10:23 CST 2005

Dan,
I don't think Fred looks like me and I'm sure he's glad he doesn't look like me!

Rick

"Dan Freeman" <spam@microsoft.com> wrote in message
news:euTDshQ9FHA.3804@TK2MSFTNGP14.phx.gbl...
> In addition to Fred's suggestion, you're missing a DO CASE at the top of the
> method.
>
> Dan
>
> John Pugh wrote:
>> Hi,
>>
>> VFP9, Win XP Pro SP2
>>
>> The following code in a class causes frequent but inconsistent
>> crashes - it may work several times and then crash - the error is
>> fatal error: exception code C00..005 with a reference to the last
>> line of the SQL statement.
>>
>> I have restarted, turned the PC off and on, cleaned up the class,
>> copied the code to a new method and tried a few work arounds (the
>> original code is commented out).
>>
>> Any suggestions as to what else to try would be great.
>>
>> John Pugh
>> Adelaide, South Australia
>> LPARAMETERS tn_id_emp,tc_filter &&, tn_Data_Session
>>
>> CASE EMPTY(tn_id_emp) &&OR EMPTY(tn_Data_Session)
>>
>> WAIT WINDOW 'Both parameters must be passed to main.calc_tax'
>>
>> RETURN
>>
>> ENDCASE
>>
>> *SET DATASESSION TO tn_Data_Session
>>
>> * Calculate the component for the passed params
>>
>> LOCAL lc_filter,lc_tab_fld,ln_amount
>>
>> * Build the name of the table.field to test
>>
>> lc_tab_fld='pay_cats.'+tc_filter
>>
>> * Calculate the amount
>>
>> lc_filter= 'WHERE pay_line.id_emp=tn_id_emp'
>>
>> lc_filter=lc_filter+' AND pay_line.id_pay_ref=params_pay.id_pay_ref'
>>
>> lc_filter=lc_filter+' AND '+lc_tab_fld+' = .T. '
>>
>> * See if the following stops it crashing...
>>
>> SELECT pay_line.amount;
>>
>> FROM pay_line ;
>>
>> JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>>
>> JOIN pay_cats ON pay_cats.id_key=pay_cats_e.id_pay_cat ;
>>
>> &lc_filter ;
>>
>> INTO CURSOR cur_tran_calc
>>
>>
>> SUM cur_tran_calc.amount TO ln_amount
>>
>> * The following kept crashing so the filter was built
>>
>> *!* SELECT SUM(pay_line.amount) AS amount;
>>
>> *!* FROM pay_line ;
>>
>> *!* JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>>
>> *!* JOIN pay_cats ON pay_cats_e.id_pay_cat=pay_cats.id_key;
>>
>> *!* WHERE pay_line.id_emp=tn_id_emp;
>>
>> *!* AND pay_line.id_pay_ref=params_pay.id_pay_ref;
>>
>> *!* AND &lc_tab_fld = .T. ;
>>
>> *!* INTO CURSOR cur_temp nofilter
>
>


Re: VFP9 keeps crashing - any suggestions by Gene

Gene
Tue Nov 29 12:57:23 CST 2005

On Tue, 29 Nov 2005 09:14:54 -0800, "Dan Freeman" <spam@microsoft.com>
wrote:

>In addition to Fred's suggestion, you're missing a DO CASE at the top of the
>method.

You appear to have only one case. If so, use an if statement
instead.

[snip]

Sincerely,

Gene Wirchenko


Re: VFP9 keeps crashing - any suggestions by Dan

Dan
Tue Nov 29 13:48:19 CST 2005

Fred, Rick, George, Roger, whatever....

<gd&r>

(I think I had one of Fred's posts elsewhere open when I replied here in a
hurry. Sorry!)

Dan

Rick Bean wrote:
> Dan,
> I don't think Fred looks like me and I'm sure he's glad he doesn't
> look like me!
>
> Rick
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:euTDshQ9FHA.3804@TK2MSFTNGP14.phx.gbl...
>> In addition to Fred's suggestion, you're missing a DO CASE at the
>> top of the method.
>>
>> Dan
>>
>> John Pugh wrote:
>>> Hi,
>>>
>>> VFP9, Win XP Pro SP2
>>>
>>> The following code in a class causes frequent but inconsistent
>>> crashes - it may work several times and then crash - the error is
>>> fatal error: exception code C00..005 with a reference to the last
>>> line of the SQL statement.
>>>
>>> I have restarted, turned the PC off and on, cleaned up the class,
>>> copied the code to a new method and tried a few work arounds (the
>>> original code is commented out).
>>>
>>> Any suggestions as to what else to try would be great.
>>>
>>> John Pugh
>>> Adelaide, South Australia
>>> LPARAMETERS tn_id_emp,tc_filter &&, tn_Data_Session
>>>
>>> CASE EMPTY(tn_id_emp) &&OR EMPTY(tn_Data_Session)
>>>
>>> WAIT WINDOW 'Both parameters must be passed to main.calc_tax'
>>>
>>> RETURN
>>>
>>> ENDCASE
>>>
>>> *SET DATASESSION TO tn_Data_Session
>>>
>>> * Calculate the component for the passed params
>>>
>>> LOCAL lc_filter,lc_tab_fld,ln_amount
>>>
>>> * Build the name of the table.field to test
>>>
>>> lc_tab_fld='pay_cats.'+tc_filter
>>>
>>> * Calculate the amount
>>>
>>> lc_filter= 'WHERE pay_line.id_emp=tn_id_emp'
>>>
>>> lc_filter=lc_filter+' AND pay_line.id_pay_ref=params_pay.id_pay_ref'
>>>
>>> lc_filter=lc_filter+' AND '+lc_tab_fld+' = .T. '
>>>
>>> * See if the following stops it crashing...
>>>
>>> SELECT pay_line.amount;
>>>
>>> FROM pay_line ;
>>>
>>> JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>>>
>>> JOIN pay_cats ON pay_cats.id_key=pay_cats_e.id_pay_cat ;
>>>
>>> &lc_filter ;
>>>
>>> INTO CURSOR cur_tran_calc
>>>
>>>
>>> SUM cur_tran_calc.amount TO ln_amount
>>>
>>> * The following kept crashing so the filter was built
>>>
>>> *!* SELECT SUM(pay_line.amount) AS amount;
>>>
>>> *!* FROM pay_line ;
>>>
>>> *!* JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>>>
>>> *!* JOIN pay_cats ON pay_cats_e.id_pay_cat=pay_cats.id_key;
>>>
>>> *!* WHERE pay_line.id_emp=tn_id_emp;
>>>
>>> *!* AND pay_line.id_pay_ref=params_pay.id_pay_ref;
>>>
>>> *!* AND &lc_tab_fld = .T. ;
>>>
>>> *!* INTO CURSOR cur_temp nofilter



Re: VFP9 keeps crashing - any suggestions by Fred

Fred
Tue Nov 29 18:57:59 CST 2005

I was going to say, I don't think I responded to that one.

The feeling is mutual, I'm sure Rick. <g>

--
Fred
Microsoft Visual FoxPro MVP


"Rick Bean" <rgbean@unrealmelange-inc.com> wrote in message
news:eOnOsAR9FHA.744@TK2MSFTNGP10.phx.gbl...
> Dan,
> I don't think Fred looks like me and I'm sure he's glad he doesn't look
> like me!
>
> Rick
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:euTDshQ9FHA.3804@TK2MSFTNGP14.phx.gbl...
>> In addition to Fred's suggestion, you're missing a DO CASE at the top of
>> the
>> method.
>>
>> Dan
>>
>> John Pugh wrote:
>>> Hi,
>>>
>>> VFP9, Win XP Pro SP2
>>>
>>> The following code in a class causes frequent but inconsistent
>>> crashes - it may work several times and then crash - the error is
>>> fatal error: exception code C00..005 with a reference to the last
>>> line of the SQL statement.
>>>
>>> I have restarted, turned the PC off and on, cleaned up the class,
>>> copied the code to a new method and tried a few work arounds (the
>>> original code is commented out).
>>>
>>> Any suggestions as to what else to try would be great.
>>>
>>> John Pugh
>>> Adelaide, South Australia
>>> LPARAMETERS tn_id_emp,tc_filter &&, tn_Data_Session
>>>
>>> CASE EMPTY(tn_id_emp) &&OR EMPTY(tn_Data_Session)
>>>
>>> WAIT WINDOW 'Both parameters must be passed to main.calc_tax'
>>>
>>> RETURN
>>>
>>> ENDCASE
>>>
>>> *SET DATASESSION TO tn_Data_Session
>>>
>>> * Calculate the component for the passed params
>>>
>>> LOCAL lc_filter,lc_tab_fld,ln_amount
>>>
>>> * Build the name of the table.field to test
>>>
>>> lc_tab_fld='pay_cats.'+tc_filter
>>>
>>> * Calculate the amount
>>>
>>> lc_filter= 'WHERE pay_line.id_emp=tn_id_emp'
>>>
>>> lc_filter=lc_filter+' AND pay_line.id_pay_ref=params_pay.id_pay_ref'
>>>
>>> lc_filter=lc_filter+' AND '+lc_tab_fld+' = .T. '
>>>
>>> * See if the following stops it crashing...
>>>
>>> SELECT pay_line.amount;
>>>
>>> FROM pay_line ;
>>>
>>> JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>>>
>>> JOIN pay_cats ON pay_cats.id_key=pay_cats_e.id_pay_cat ;
>>>
>>> &lc_filter ;
>>>
>>> INTO CURSOR cur_tran_calc
>>>
>>>
>>> SUM cur_tran_calc.amount TO ln_amount
>>>
>>> * The following kept crashing so the filter was built
>>>
>>> *!* SELECT SUM(pay_line.amount) AS amount;
>>>
>>> *!* FROM pay_line ;
>>>
>>> *!* JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
>>>
>>> *!* JOIN pay_cats ON pay_cats_e.id_pay_cat=pay_cats.id_key;
>>>
>>> *!* WHERE pay_line.id_emp=tn_id_emp;
>>>
>>> *!* AND pay_line.id_pay_ref=params_pay.id_pay_ref;
>>>
>>> *!* AND &lc_tab_fld = .T. ;
>>>
>>> *!* INTO CURSOR cur_temp nofilter
>>
>>
>



Re: VFP9 keeps crashing - any suggestions by swdev2

swdev2
Wed Nov 30 03:00:23 CST 2005

Heya John -
in addition to what da rest of dem said -
I suggest you handle some variable evaluation and check for NULLS.
when you add a character string and a null together, the result is a NULL
when you add an integer and a null together, the result is a NULL .

in some cases, you can get erroneous results when you are attempted to
dynamically build
command line strings, sql pass through, and other fun stuff like codeblocks
for runtime evaluation.

Check Yer Nulls, Dude...

also - is it possible you are getting variable type mismatch?
in one area , you are doing this -

lc_tab_fld='pay_cats.'+tc_filter
which i think is gonna eval to a variable of type character, so far, but
have no clue as to the data type held in that field. whaddya do when
tc_filter is null?

then further on, you are doing an eval on the value stored in this field,
and then checking to see if its value is
equal to true - i. e. -
&lc_tab_fld = .T
in the AND portion of yer where clause.

so be careful - there's a great difference between straight evaluation,
macro expansion, and inline evaluation () .
I'm betting the area thats blowing up on you, since it blew up on me ages
past, lies in the macro expansion line -
&lc_tab_fld = .T

I'd suggest you muck about with how you get the field name and value one
more time - you'll find nirvana momentarily.

mondo regards [Bill]
--
===================
William Sanders / EFG VFP / mySql / MS-SQL
www.efgroup.net/vfpwebhosting
www.terrafox.net www.viasqlserver.net

"John Pugh" <notreal@xyx.com.zz> wrote in message
news:438c0311@dnews.tpgi.com.au...
> Hi,
>
> VFP9, Win XP Pro SP2
>
> The following code in a class causes frequent but inconsistent crashes -
it
> may work several times and then crash - the error is fatal error:
exception
> code C00..005 with a reference to the last line of the SQL statement.
>
> I have restarted, turned the PC off and on, cleaned up the class, copied
the
> code to a new method and tried a few work arounds (the original code is
> commented out).
>
> Any suggestions as to what else to try would be great.
>
> John Pugh
> Adelaide, South Australia
[snip]



Re: VFP9 keeps crashing - any suggestions by John

John
Fri Dec 02 01:42:13 CST 2005

Many thanks for the feedback.

I have changed the way I did this - the problem seemed to be witht he macro
substitution (I had not copied the DO CASE).

The strange thing is that it would work sometimes many times then crash.

Cheers,

John



Re: VFP9 keeps crashing - any suggestions by swdev2

swdev2
Sat Dec 03 02:06:31 CST 2005

Heya John - its cool you got it fixed.
It's even more interesting that no one else (but me) suggested where the
problem lies.
Them MVP's - I swear - (*@&(@*&(*@# and **..
regards [Bill]
--
===================
William Sanders / EFG VFP / mySql / MS-SQL
www.efgroup.net/vfpwebhosting
www.terrafox.net www.viasqlserver.net

"John Pugh" <notreal@xyx.com.zz> wrote in message
news:438ffae1$1@dnews.tpgi.com.au...
> Many thanks for the feedback.
>
> I have changed the way I did this - the problem seemed to be witht he
macro
> substitution (I had not copied the DO CASE).
>
> The strange thing is that it would work sometimes many times then crash.
>
> Cheers,
>
> John
>
>