preopenstack do not works in a stack that I transfered from mc to rev
Sarah Reichelt
sarah.reichelt at gmail.com
Sat Jun 10 18:16:59 EDT 2006
> I made my stack "xyz" with mc 2.6.1. Then I opened it in rev 2.7.1 to
> connect it to a SQL-database.
> In the stackscript of "xyz" I put the same code as in the stack
> "SQL-Test" I made with rev directly.
> The stack "SQL-Test" connects well to its database, but in my stack
> "xyz" this code don't work.
>
> Here it is:
>
> on preopenstack
> global gConID
> put revdb_connect("sqlite3","DB_FLK.db",,,,,"my emailadress","my
> password") into tConID
> if tConID is "" then
> answer warning "Problem creating or accessing database!"
> else
> answer information "DB_FLK Connected! Your connection ID is: " &
> tConID
> put tConID into gConID
> end if
> end preopenstack
>
> When I create a button in the opened stack with the same code I get a
> connection to the database.
> Do anybody knows a help?
I think that when you try to open the database in your preOpenStack
handler, the database library has not yet been loaded. Try setting up
a delayed call to open it e.g.
on preOpenStack
send "connectToDatabase" to me in 1 second
end preOpenStack
on connectToDatabase
global gConID
put revdb_connect("sqlite3","DB_FLK.db",,,,,"my emailadress","my
password") into tConID
if tConID is "" then
answer warning "Problem creating or accessing database!"
else
answer information "DB_FLK Connected! Your connection ID is: " &
tConID
put tConID into gConID
end if
end connectToDatabase
HTH,
Sarah
More information about the use-livecode
mailing list