How to use Automatic query builder to insert a record!

Jan Schenkel janschenkel at yahoo.com
Thu Aug 7 02:38:01 EDT 2003


--- Andre Garzia <soapdog at mac.com> wrote:
> 
> > Hi Andre,
> >
> > You'll have to do a tiny bit of scripting, but
> it's
> > really easy -- suppose the name of your query is
> > "Foobar", then create an Insert button and set its
> > script to :
> >
> > --
> > on mouseUp
> >   revExecuteWithQuery "Foobar", \
> >      "INSERT INTO users VALUES(2003,'Andre
> Garzia')"
> > end mouseUp
> > --
> >
> > Hope this helped,
> >
> > Jan Schenkel.
> 
> 
> Hi Jan,
> 
> first tanx for the quick answer.
> 
> let me see if i get it... i must change the SQL
> query in my automatic 
> query from select to insert... right?
> 
> if thats so, how does it get the values from the
> fields?
> 
> I can't find revExecuteWithQuery in the transcript
> dictionary.
> 
> Uh... are thoose undocumented featues?
> Andre Alves 

Hi Andre,

The command 'revExecuteWithQuery' is indeed one of the
undocumented features of the Database Query library.
- its first parameter is the name of an existing query
that connects to the database you want to execute the
SQL query on ;
- its second parameter is the actual query.
It does not make any change to your predefined query,
it merely borrows the connection info.

If you want to learn more about the undocumented
Database Query library, do the following :
- open the message box
- click the button tooltipped 'FrontScripts'
- tick the checkbox 'Show Revolution UI frontscripts'
- select in the list the item 'revDatabase'
- and click the button 'Edit the script'
While you're in there, make sure not to modify
anything, and should the IDE ask if you want to save
changes, click 'Do not save' :-)

Of course Monte's solution, using the documented
library calls, works just as well ; but the above
integrates nicely with the Database Query Manager.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the use-livecode mailing list