David,
Thanks for attention to my probem...
realy. Today I try to prepare separate example of this probem for you.. and no C0000005 error happen... but I using same database table as source for localview. To prepare extended example need time ;) so.. your code and my little ex. code - works perfect.
But my app always crush on CREATE SQL VIEW... always...
(this is program for database replication)
I don't understand why it happens but steps of program is next:
1) Database has "transaction" table. I made insert new record to this table with "soure_database","source_table","unique_id" (source of replication)
2) "transaction" table has "oninsert" event - this event call replication between diffrent databases ( I have special table which contains relations and list of fields to update, and additional scripts and so on)
3) prgram looking for special relations between database.. OPEN DATABASE (destinationDatabase) and then switch back to current database and create new Localview based on EXTERNAL database.
4) and then - application crush.
Maybe because I switch betweed diffrent databases inside stored procedure its happens..
>Denis,
>
>I wonder if you have some sort of DBC corruption going on? This works fine for me:
>
>
>create database denis
>create table test ( i1 i, c1 c(10), m1 m )
>insert into test values ( 1, "test 1", "testmemo1" )
>insert into test values ( 2, "test 2", "testmemo2" )
>
>MODIFY PROCEDURE
>
>* these are the two SPs I've created
>
>function denis1(lnI1)
>create sql view denis1 as select * from denis!test where i1 = (?lnI1)
>endfunc
>
>function denis2()
>create sql view denis2 as select * from denis!test where i1 = (?gnI1)
>endfunc
>
>* now back to the test code
>
>lnI1 = 2
>denis1()
>use denis!denis1
>browse last
>
>denis2()
>use denis!denis2
>
>
>
>>Yes. I can create view from code - not from stord proc. This bug happens in the VFP8.. and all works perfect in VFP9. So..I think its bug of VFP8