On May 28, 2004, at 10:27 PM, GAmoore at aol dot com wrote:
This is sort of related to my last question. I want to make a
"Settings"
folder in the same locale as the application - if it doesn't exist
create, if it
does exist, then put files into it. I'm a little confused as to the
create/connection distinction in this case. Similarly, with databases
.... I read the
examples for creating a new database or opening an existing one.
However, how can
you open it if it exists, create it if it does not exist?
if dbFile.exists then
// it exists
else
// it doesn't exist
end if
//...- this would make it easier to modularize that operation, but
how do
you pass the db references?
Declare a method with the parameter "db as Database". Just pass it then.
//do DB stuff here for both cases (connected to existing, or
just
created) - knowing that you
// can't get here in bad cases (not created or not
connected) -
however this leaves me feeling
// like there might be some case where the control can
somehow
sneak into this part of code
If you ever have an error, feel free to use the "return" statement to
leave the function. For example:
if not db.Connect then
MsgBox "Couldn't connect."
return
end if
// go on your merry way
If it couldn't connect, it won't ever get past that return statement.
HTH,
Jon
--
Jonathan Johnson
Testing Department
REAL Software, Inc.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|