This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.
A model which reads data from the Access 2003 Database "Sample_Database_TD.mdb".
Be sure there is an alias (Sample_Database_TD) created for the database. This is done using the "Data Sources" option in the Windows Control Panel.
In German Windows XP this is done under: Systemsteuerung | BDE Administrator or Systemsteuerung | Verwaltung | Datenquellen (ODBC).
In German Windows Vista this is done under: Systemsteuerung | Verwaltung | Datenquellen (ODBC) or if using Vista 64bit in the Explorer under \Windows\SysWOW64\odbcad32.exe.
On Reset the database connection is done and the table of the database opens, to show the data.
These data in the database define properties of the items like itemtype, itemname, itemsize and color.
Defining the color is special because in the database the name of the color is written (blue, green, yellow). This makes is necessary to use executestring which concats a command and executes it.
Code can be found:
UserEventInit
Trigger on Exit of Source
Trigger on Entry of Sink
Attention:
Do not delete or rename the object Logo_FlexsimD, because otherwise the model will not work correctly. Also do not rename, delete or re-rank other objects.
Thanks for uploading this, Ive been curious above connecting to db's for a while. Just having a bit of trouble getting it working: Do i use a User, System or file DSN connection? I've always used file for working is SQL studio but it doesn't seem to be working.
Also, I got this error in the compiler console when i loaded it:
Flexscript Error MAIN:/project/events/OnStart line 0 syntax error, unexpected ',', expecting end of code
And the whole application terminates itself for some reason at random times!?
Thanks
Paul
Sung Kim 04-06-2010 at 07:28 AM
Dear Tom,
I extracted the model to \userprojects\SampleModels\ folder as you suggested, and tried to run it. However, it just disappears when I click a few run control buttons (or any mouse clicks). Is it due to version conflict?? I use v4.5.2. Maybe it is just my machine, but I appreciate if you gives me a clue of my misdoing.
Thanks,
Sung