Has anybody any experience with inserting a record under program control?
Consider the following code:
dr=hk_drivermanager()
con=dr.new_connection("mysql")
con.connect()
db=con.new_database("musik")
query=db.new_actionquery()
insertString = "NewCD"
query.set_sql("INSERT INTO CDDisk (CDName = " + insertString + ")")
query.execute()
query=db.new_resultquery()
query.set_sql("SELECT last_insert_id() from CDDisk")
CDDiskID=query.show_currentrow()
hk_thisform.show_warningmessage(CDDiskID.asstring())
Here I wanted to do what I have done with other database frontends many times
before: 1. Insert a new record into a table, 2. get the key value of
the inserted record, and 3. open a form and position the same on this
new value for further data editing.
Unfortunately, the insert query does not work. There is no error message, but
there is also no new record inserted. The "SELECT last_insert_id()" fails,
because there is no data - obviously.
What can I do in order to get the insertion query working? Is there an error in
the syntax? is the "query.execute()" the correct function?
Unfortunately, the Knoda docu is silent on inserting records under program
control. A representative example would be welcome and useful.
Thanks for any help
Egbert
---------------------------------
Yahoo! Answers - Get better answers from someone who knows. Tryit now.-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss