I am use to using mySQL when connecting to databases using livecode.
However, I now need to connect to a SQL2008 database... Is this possible with Livecode?
I am currently using the following code:
Code: Select all
on mouseUp
-- use a global variable to hold the connection ID so other scripts can use it
global gConnectionID
-- set up the connection parameters - edit these to suit your database
put "82.70.24.xxx" into tDatabaseAddress
put "salesloxxx_xxx" into tDatabaseName
put "saleslxxx_sxxxd" into tDatabaseUser
put "saleslxxx_xxxxxx" into tDatabasePassword
-- connect to the database
put revOpenDatabase("mysql", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
-- check if it worked and display an error message if it didn't
-- & set the connection ID global
if tResult is a number then
put tResult into gConnectionID
answer info "Connected to the database." & cr & "Connection ID = " & gConnectionID
else
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
end if
end mouseUp
Many thanks
Daniel