Accessing a database with Macomedia Director
Working on a university project which included a need for Macromedia Director to access a database (in my case, MS Access). I downloaded ADOXTRA.X32 from XtraMania.com, copied it into my D:Program FilesMacromediaDirector 8.5Xtras folder, then with a bit of tinkering, I wrote the following Lingo function:
on GetDatabaseField (SQL,Column)
ADO = xtra("ADOxtra")
ADO.Init(true)
gRst = ADO.CreateObject(#Recordset)
gRst.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Mode=Read;Data Source=" & the moviePath & "prototype.mdb"
gRst.cursorLocation=gRst.adUseClient
gRst.LockType=gRst.adLockReadOnly
gRst.CursorType=gRst.adOpenStatic
gRst.Source=SQL
gRst.Open()
if gRst.Failed then
alert gRst.LastError
halt
end if
gRst.MoveFirst()
retVal = gRst.fields[Column]
gRst.Close()
return retVal
end
Which is called with something along the lines as:
on
mouseDown me
set the text of member "DynamicText" = GetDatabaseField ("select firstname from people where id = 1 ","firstname")
end