Re: Changing the database at runtime
Posted in 1996
Malcolm Weallans writes: * * Mike is basically correct. But you do need source! and the database * defined at the beginning of the MAIN module MUST exist. Otherwise you * get a -329 Database not found or no system permission error. Correct. Just to add in. Let's say I have a database called MINE.DBS. So, I have at the beginning of my MAIN module DATABASE MINE. DATABASE MINE MAIN etc... Now, let's say I have the actual DB i want to connect to called YOURS. Doing the following: DATABASE MINE MAIN DATABASE YOURS etc... This forces BOTH database to exist without any errors occuring. Basically, you want to do NO database stuff in the module containing the MAIN and make the MAIN function the only function in the MAIN.4GL. You could even pass in the database name if you wanted to. # main.4gl MAIN DEFINE db_name CHAR(20) LET db_name = ARG_VAL(1) -- please put error checking in CALL program_start(db_name) -- call the program.4gl module which -- does everything END MAIN # program.4gl DATABASE MINE -- This is only now for compile time. FUNCTION program_start(db_name) DEFINE db_name CHAR(20) DATABASE db_name etc... END FUNCTION Thanks, ----------------------------------------------------------------------------- Robert Minter Data Systems Support Senior Software Engineer A Client Technologies Company E-Mail: rob@dssmktg.com Tel: 714.771.0454 #include <disclaimer.h> Fax: 714.771.3028 De Colores - Emmaus OC-13 http://www.dssny.com