Thanks very much, I have insert working now.
Now there is another problem. Consider the following code snippet:
query2=db.new_resultquery()
query2.set_sql("SELECT last_insert_id() from CdDisk")
query2.enable()
CdDiskID=query2.show_currentrow()

The last_insert_id() function is is available in mysql to return the key value 
of the last record inserted into a table. I have used this many times in other 
applications. It does not work properly in Knoda, as it always returns 0 
instead of the correct key value. 
Is this a bug in Knoda, or is something else wrong?
It is too useful that I would not like to do without it.
Egbert


DJ Anubis <[EMAIL PROTECTED]> wrote: Egbert Eissing a écrit :

Hi Egbert,
Ypur problem is in your SQL syntax.
>
> query=db.new_actionquery()
> insertString = "NewCD"
> query.set_sql("INSERT INTO  CDDisk (CDName = " + insertString + ")")
> query.execute()
>
Standard SQL syntax for INSERT statement is:

INSERT INTO CDDisk (CDName,[other_field,...]
VALUES( insertString, [othervalue,...] )

while in your query you used UPDATE syntax which is:

UPDATE CDDisk SET CDName = 'New Name'

> Unfortunately, the Knoda docu is silent on inserting records under
> program control. A representative example would be welcome and useful.
> Thanks for any help
Well, when you directly use SQL statements, you should refer to your
database manuel, such as
http://dev.mysql.com/doc/refman/5.0/en/insert.html if using MySQL, or
postgreSQL syntax. On such simple queries, all current database
management actually use the same syntax.




-------------------------------------------------------------------------
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


       
---------------------------------
 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

Reply via email to