Home > Uncategorized > Accessing a database with Macomedia Director

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

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: