Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird problem
Message
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:
01519957
Views:
82
This message has been marked as the solution to the initial question of the thread.
>>>>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.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform