Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening the database
Message
From
24/08/1999 18:48:19
 
 
To
14/08/1999 14:45:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00253709
Message ID:
00257363
Views:
16
>Roelaux-
>
>In that case, you might want to add code to the load method of your form that sets the Database property of all your Dataenvironment cursors depending on whether you are live or testing. It's similar to the idea of having multiple sets of data.
>
>Something like this (pseudo-code):
>
>
*form.load()
>For each item in the this.dataenvironment collection
>  if it's not a cursor
>    loop
>  endif
>  if using live data
>    set cursor.database to \mylivedata
>  else
>    set cursor.database to \mytestdata
>  endif
>next
>HTH
>>Hello Nancy-
>>
>>Thank You for the response!!!
>>
>>I do not explain my self well sometimes. I use two sets of data 1)Is the working set that the office runs on and the 2) Is the set that I do testing and programing against. I unzip the back up from the previous night to my hard drive.(I'm still learning, will keep this habit up as a standard) At times I need to point to the working set to use the (shall we say live data). What I don't want to have to do is hard code through out my source code to get the right data. If I do it that way I ASSUME this defeats the purpose of what I understand OOP to be. In code
DO MyPath
. If I store the path to memory then I can reference using something like
GET gMyPath
then depending on which set of data I need to use I can change the hard code in MyPath and reference using the same command no matter which set of data I chose to use. I do not know for sure that I'm on the right PATH or Not.
>>

Nancy,

Sorry so long in answering.

I wrote the following code to call a form Pointto. On the form I added a combobox that access a free table with the names of my datafiles.
 do c
g_pname=" "

do form Pointto

close tables all

DO CASE
	CASE g_pname="DSS"
 		open database F:\DSS\DATA\ims.dbc
	CASE g_pname="TMS"
  		open database D:\AATMS\DATA\ims.dbc
	CASE g_pname="IMS"
  		open database F:\IMS2W\DATA\ims.dbc
	OTHERWISE
    	DO END
ENDCASE

RETURN	
It calls and loads the form then opens the datacontainier(sp) when I test it in the debugger.

However when I run it from the command window it generates this error message
Cannot access the selected table (Error 1152)
Any Ideas??
>>
>>
>>
>>>Hi, Roelaux-
>>>
>>>If your tables and DBC are in the same directory as your EXE you can in your main program do *something* like this
SET DEFAULT TO SYS(2003)
. Then, whenever you
USE myDBF
the table (and its memo and indices) will be found and opened.
>>>
>>>If you are using the DBC, you don't have to separately open the DBC, but if you want to, the command is
OPEN DATABASE myDBC
.
>>>
>>>Note, this is a bit more complicated if your data is not in the same path as your exe. Then you can use SET PATH to tell your EXE where to look for files. That's a start. It can be just about as complicated as you need it to be, so please repost a follow up to your thread if this doesn't make sense or doesn't fit your situation.
>>>
>>>HTH
>>>
>>>>In the FP examples they are constantly use the home()command + \test\data\ my data is not in this directory.(I really fell dumb asking this) Please give me some examples of how to point to and open my database container programmaticly so that I can call the program to ensure that I'm pointing to my data set before I run a program.
Previous
Reply
Map
View

Click here to load this message in the networking platform