Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird problem
Message
 
 
To
02/08/2011 15:45:27
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01519939
Message ID:
01519958
Views:
47
>>>>>Are variables in scope?
>>>>
>>>>Yes, the first query works fine and returns 7 records. The second query that is supposed to access the temp table is failing.
>>>
>>>
>>>if [<< var >>] worked and [?var] not, then usually the variable is out of scope (or is redefined somewhere).
>>>
>>
>>There is nothing that re-defines them in the whole code:
>>
>>PRIVATE cDep, cCat, cItem
>>cDep = EVL(substr(lcViewVar,1,10),NULL)
>>cCat = EVL(substr(lcViewVar,11,10),NULL)
>>cItem = EVL(substr(lcViewVar,21,10),NULL)
>>
>>TEXT TO lcS TEXTMERGE noshow
>>SELECT * FROM ItemFund
>>where department = ?m.cDep and Category = ?m.cCat and Item = ?m.cItem
>>endtext
>>
>>mysqlexec(m.lcS, 'csrItemfund', program())
>>select csrItemfund
>>if reccount() = 0
>>	append blank
>>endif
>>
>>TEXT TO lcS noshow
>>SELECT * FROM i_invent
>>where department = ?m.cDep and Category = ?m.cCat and Item = ?m.cItem
>>endtext
>>
>>mysqlexec(m.lcS, 'i_invent', program())
>>
>>make_view_updatable('i_invent',5)	&&table buffering 
>>
>>TEXT to lcS NOSHOW 
>>if object_id('tempdb..#csrI_Item') is not null drop table #csrI_Item
>>select * 
>>  into #csrI_Item
>>  from i_items  
>>  where department = ?m.cDep
>>  and category = ?m.cCat
>>  and item = ?m.cItem
>>SELECT * from #csrI_Item
>>ENDTEXT  
>>
>>mysqlexec(m.lcS, 'i_items', PROGRAM())
>>
>>TEXT to lcS NOSHOW 
>>
>>select * from i_attlnk WHERE invent_id in (select invent_id FROM #csrI_Item)
>>DROP TABLE #csrI_Item
>>ENDTEXT  
>>mysqlexec(m.lcS, 'i_attlnk', PROGRAM())
>>
>
>
>Check with SQL Profiler what is the query sent to sql server.

I reverted to using variables and it worked fine. I'm going to change it once again to parameters and re-test with SQL Profiler.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform