Hi!
Recently I have just started using MyDAC on D7 and everything seemed fine until the time came where I wanted to post a simple record.
First I check if the field already exists using .locate. If the field exists the value is changed otherwise a new record is appended.
When the table is empty there is no problem in have the first record accepted, but when I get to the second record, which is a new record, I get the following error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FieldName3, FieldName4) VALUES (Value1, Value2, Value3, Value4)' at line 2'.
(There are 4 fields in a record and as you may notice, then field name 1 and 2 is not listed).
The same error message occurs when I try using .post with the first record .
The MySQL server is version 5 and MyDAC is ver. 4.30.
Have anybody seen this before and do you have suggestion to a solution?
Kind regards,
Thim
Error when using .locate, .post and posting records in general
You should post some more info, like table structure, and sql you're running (Also if you're using a myTable or myQuery). But my first guess is that you're putting also a SQLInsert/SQLUpdate sentence.
Also add primary keys to your tables, this will avoid you lots of problems.
And to improve more, use a Update SQL, if affectedrows is 0 then insert, this will be kicking faster than performing a locate, specially with larger db's!.
Also add primary keys to your tables, this will avoid you lots of problems.
And to improve more, use a Update SQL, if affectedrows is 0 then insert, this will be kicking faster than performing a locate, specially with larger db's!.