Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
command DBConnect
local lDatabaseFile
global gDatabaseID
put specialFolderPath("Documents") & "\DBInv.db" into lDatabaseFile
if there is no file lDatabaseFile then
Beep
Answer Error "No Database Found!" titled ""
else
put revOpenDatabase("Sqlite", lDatabaseFile) into gDatabaseID
answer gDatabaseID
end if
end DBConnect
If Mark's way works then you can use it, but I'm a little surprised if it does work since LC uses forward slashes for all file paths. Normally we'd use this:
On my Windows 11 machine I do not get the fully resolved path if concatenating with other path information using specialfolderpath("whatever") &"/foldername/foldername/filename" and storing the path in a variable.
# Here is a non-working and working line in my Windows environment
put specialFolderPath ( "documents") & "/LC/data" into tPath -- will not work. The variable is not recognized as a path.
put ( specialFolderPath ("documents") & "/LC/data" ) into tPath -- works using parenthesis. The variable is recognized.
golife wrote: Thu Jun 16, 2022 4:20 pm
Windows 10 / 11
On my Windows 11 machine I do not get the fully resolved path if concatenating with other path information using specialfolderpath("whatever") &"/foldername/foldername/filename" and storing the path in a variable.
# Here is a non-working and working line in my Windows environment
put specialFolderPath ( "documents") & "LC/data" into tPath -- will not work. The variable is not recognized as a path.
put ( specialFolderPath ("documents") & LC/data" ) into tPath -- works using parenthesis. The variable is recognized.
i'm sure it's a typo, but your second line is missing a quote.
However, both lines are wrong as you need to add a preceding slash to the second part, ie :
I think what might have been missed is that you already have the full path to the database file.
You don't need specialFolderPath at all for this case.