SQL connections
Bernard Devlin
revolution at knowledgeworks.plus.com
Fri Nov 1 15:01:01 EST 2002
I use this script in the onMouseUp event of button that gets a connection:
put revdb_connections() into connectionList
if connectionList is empty then
put the text of button btnDbType into DbType
put the text of field fdDsn into Dsn
put the text of field fdUsername into Username
put the text of field fdDsn into thePassword
get revdb_connect(DbType,Dsn,"",Username,thePassword)
wait 3 seconds -- not sure if it needs to wait as long as this
put revdb_connections() into connectionList
if connectionList is empty then
answer "problem connecting to specified datasource"
else
set the cpConnNumber of field fdDsn to It
-- here the connection number is stored as a custom property so it
can be grabbed when needed
end if
end if
You will need to configure the Dsn (ODBC DataSource Name). I know how to do
this on Win2k and Linux, but not on OS X. It means you will need to have ODBC
drivers for the database you are using (unless you are using MySql, Oracle or
Valentina - in which case I believe you can make use of the connectors supplied
with Rev.)
Here is the code you can put in a handler to take the SQL from a field, run it
against the ODBC connection, and display the result in another field:
put the cpConnNumber of field fdDSN into theConnection
get revdb_querylist(comma,return,theConnection,field "fdQuery")
put it into field fdResultset
Hope this helps.
> > Does anyone have a simple, straightforward example of connecting to
> > an SQL data base file to read or write text data?
> Also looking for this, please...
> Setting up OBDC databases for multiplaform access does not seem obvious to
> me... :-(
>
> Andr
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list