Page 1 of 1
Help on on pre??
Posted: Wed May 13, 2009 4:58 pm
by snapper1969
Hi,
I'm totally new to this and am trying to work out how to connect to / create a sqlite db without using on mouse up. I'd like to connect / create the database automatically when the program starts. Can anybody help?.
Thx,
John
Posted: Wed May 13, 2009 8:39 pm
by Janschenkel
Youy can put something like this in the script of the first card of your stack
Code: Select all
on openStack
local tPrefsPath, tDbPath
put specialFolderPath("Preferences") into tPrefsPath
put tPrefsPath & slash & "MyApp.db" into tDbPath
global gConnectionId
put revOpenDabase("sqlite", tDbPath, , , , ) into gConnectionId
if gConnectionId is not a number then
answer error "Could not create or open database:" && tDbPath
end if
end openStack
HTH,
Jan Schenkel.
on Pre
Posted: Wed May 13, 2009 9:00 pm
by snapper1969
Hi Jan,
Thx for the reply....It's coming up with an error:
stack "Invoice Register": execution error at line 6 (Function: error in function handler) near "revOpenDabase", char 7
Any ideas?.
Thx,
John
Posted: Thu May 14, 2009 5:44 am
by Janschenkel
Typoes happen - line 6 should read
Code: Select all
put revOpenDatabase("sqlite", tDbPath, , , , ) into gConnectionId
Jan Schenkel.
on Pre?
Posted: Thu May 14, 2009 6:50 pm
by snapper1969
Hi Jan,
Thx...I should've posted that, much appreciated.
John