Hi. Does INSERT INTO not work with MySQL? I have a bunch of data that I want to save to a MySQLCommunity Server table, and I just learned of the whole BEGIN TRANSACTION deal, but it’s not seeming to work for MySQL

Just testing it out quickly, I used this below. Right above this code is where all the connection setup is

[code] If mDb.Connect Then
IsConnected = True


mdb.SQLExecute "INSERT INTO questiondifficulty ('Product', 'RefID', 'Correct') VALUES ('1', '2', '3');"


End If[/code]

But this doesn’t seem to save to the table. Yet, similar code works with SQLite. Is this process saved differently in MySQL? Or is something missing in the code?

I have been using new databaserecord, but this is slow, and like I said, I just discovered the above and love the speed of it

You MUST always check the db.error bit after SQLExecute. It’s the only way to know if you have an error in your SQL.

if mdb.error then msgbox mdb.errormessage return //why go further? You had an error. end

Mysql uses “START TRANSACTION”, with a space between the words. Or simply “BEGIN”.

Thanks for the help! Bob - I tried using the error code, and it says where the error is coming, which is in this line

mdb.SQLExecute "INSERT INTO questiondifficulty ('Product', 'RefID', 'Correct') VALUES ('1', '2', '3');"

and specifically in this part

'Product', 'RefID', 'Correct') VALUES ('1', '2', '3')

I just searched online and found that with column names in MySQL, you don’t include the hyphen, so this code works

mdb.SQLExecute "INSERT INTO questiondifficulty (Product, RefID, Correct) VALUES ('1', '2', '3');"

Appreciate the help! And yes Tim, I changed BEGIN to START, and all good now thanks!