[Closed] run sql script in max listener
i admit though not new to scripting but i am new to max. Its been a while that i am trying just to run this script
http://www.oferz.com/Tutorials/tutMySQLConnector.html
someone will have to spoon feed this to me.
I figured till here.
(local host = “localhost”)
(local database = “mysql”)
(local user = “root”)
(local password = “12345678”)
this one gives error.
(local connectionString = “Database=” + database + “
bottom line : after connecting to sql, I need to get the scene filename and send it to the table. Any clues.
alternatively, is their any tutorial that will see me thru.
Hi,
The problem is that code executed in the maxscript listener is in global scope. What you put inside brackets is in local scope (this is why you could use the “local” definition). The thing is, what ever is defined in local scope only lives for the duration of that scope, so, once the closing brace is reached, the local variable is discarded. this means that by the time you get to the line: (local connectionString = “Database=” + database + … the variable “database” no longer exists.
To solve this, either use global variables (leave out the braces and the local definition) – this is not recommended, or, open a new maxscript file (you don’t have to save it, you can simply execute it) that looks something like this:
(
local host = "localhost"
local database = "mysql"
local user = "root"
local password = "12345678"
local connectionString = "Database=" + database + ";Data Source=" + host + ";User Id=" + user + ";Password=" + password
)
Cheers,
o