Hello,
I'm trying to make use of the MySQL Last_Insert_ID() function, and I'm not having any success.
dbConn.Open()
dbCmd = dbConn.CreateCommand
dbCmd2 = dbConn.CreateCommand
dbCmd.CommandText = "UPDATE schedulesequence set id = LAST_INSERT_ID(id + 1)"
dbCmd.ExecuteNonQuery()
dbCmd2.CommandText = "INSERT INTO download(id, server) " & _
"VALUES(LAST_INSERT_ID(), " & Trim(TextBox1.Text) & ")"
dbCmd2.ExecuteNonQuery()
The update to the sequence works, but the insert statement generates the following error.
Error:MySql.Data: Unknown table 'www.popnetworks' in field list
The value of TextBox1.Text is www.popnetworks.net.
Why did the value of the textbox get shorted?
When I expanded the query by inserting more values in more fields, the insert statement generated syntax errors. The other values were from three other textbox controls.
Thanks for your help.
Kerry
I'm trying to make use of the MySQL Last_Insert_ID() function, and I'm not having any success.
dbConn.Open()
dbCmd = dbConn.CreateCommand
dbCmd2 = dbConn.CreateCommand
dbCmd.CommandText = "UPDATE schedulesequence set id = LAST_INSERT_ID(id + 1)"
dbCmd.ExecuteNonQuery()
dbCmd2.CommandText = "INSERT INTO download(id, server) " & _
"VALUES(LAST_INSERT_ID(), " & Trim(TextBox1.Text) & ")"
dbCmd2.ExecuteNonQuery()
The update to the sequence works, but the insert statement generates the following error.
Error:MySql.Data: Unknown table 'www.popnetworks' in field list
The value of TextBox1.Text is www.popnetworks.net.
Why did the value of the textbox get shorted?
When I expanded the query by inserting more values in more fields, the insert statement generated syntax errors. The other values were from three other textbox controls.
Thanks for your help.
Kerry