How to use Automatic query builder to insert a record!

Monte Goulding monte at sweattechnologies.com
Thu Aug 7 01:25:01 EDT 2003


> 
> Hi Folks,
> 
> I just moved from my rev 1.0 to rev 2.0 and well, it's 2:38 in the 
> morning and i can't stop coding. I am exploring the new database 
> features and I have a doubt. I made a simple address book app for me, I 
> am using a MySQL database and using automatic query builder. All my 
> fields are being updated correctly and my navigation buttons working 
> fine, I can explore and modify my database with no trouble, but if I 
> want to add a new record? how am i supposed to go? is there any way to 
> do so without scripting? Can someone help me, this will be fundamental 
> do my decision to buy revolution this week or next month (my salary is 
> short, but if this is as easy as i think it is, then God, i'll just 
> have to buy it asap!!!!)
> 

Hi Andre

I don't know about doing it without scripting but here's the general idea with scripting:

This code will save listed fields into the database. The fields should be the same name on the card as in the table.

on mouseUp
  put 1 into i
  put "INSERT INTO MYTABLE SET" into tSQL
  repeat for each item tItem in "FirstName,LastName,Email"
     put fld tItem into tVariableA[i]
     " "&tItem&"= :"&i after tSQL
  end repeat
  revExecuteSQL gDBref,tSQL,tVariableA
end if

Cheers

Monte




More information about the use-livecode mailing list