Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correct way to call DBC stored procedure
Message
From
05/01/2002 10:31:13
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00523854
Message ID:
00601138
Views:
26
Hi Nadya

I just hit this old problem of yours for myself.

The solution I would like to see is a change to my nextkey() SP so that it ensures the keytable being used lives in the same DBC as the table requiring a new key.

something like.
lcDBC = cursorgetprop('database') && hopefully this will contain the name of the dbc() for the table being operated on

* --- Open table of next keys
If USED("NextKey") and dbc('database','nextkey')<>lcDBC
	use in  NextKey
endif

If USED("NextKey") 
   select nextkey
else
   Use (lcDBC+'!'+'nextkey')
Endif
I was wondering if you had come across something like this in your searches
regarding your problem and had a debuuged example I could use.




>Hi everyone,
>
> We were just hit by this problem: we have lNextID function in our common procedure file. We also have a function with the same name in different DBC stored procedure. I noticed, that the wrong function was called, even if I set database to myDatabase. I have a view, which is based on tables from two databases (Stats - my database and Customer table, which is part of JobControl database). I put code in form's Add method:
>lnRegionID=lNextID('Regions') and it invokes lNextID from JobControl database stored procedure, not my Stats database.
>
>So, how should I ensure, that my code is called. Right now I decided to change name of my stored procedure function to GetNext_ID, but it's not a universal solution.
>
>Another problem:
>My underlaying table has a default value, which is (changed it right now) GetNext_ID('Regions')
>
>In my add method I do:
>lnRegionID=GetNext_ID('Regions')
>insert into RegionsInfo (RegionID,...) values (m.lnRegionID,...), where RegionsInfo is a view based on Regions table (only this table).
>
>The question is: when I save the record, would it try to excecute this GetNext_ID twice, since my table has default value? Right now it seems to be doing that. What should I do to do it only once?
>
>Thanks in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform