I need to establish an order to my photos. I designed this table to rearrange the order then update them one by one.
I started out with a combobox, had it bound and sourced to a datatable. The thing is I changed my mind on how I wanted to tackle this so I changed my algorithm. I went with a listbox instead. I also went from reading it into my control, to reading it into an array because I can't reorder a bound source. I used the same update code from the combobox that was working perfect and all I changed was the query string, value for value the nearly same stuff. I changed the column name in MySql from isPrimary type CHAR to order type VarChar(3). I changed the right stuff I know, so why the sudden syntax error with my MySql query?
Here is my update code behind the update button:
This is the error message I get...Code:Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click 'Update photos with which is the primary image. 'UPDATE part_storage.PNL idPNL, LinkPNL, PNL, PNLPrimary QueryUpdate = "UPDATE part_storage.photos SET order='" & ListBoxImgURL.SelectedIndex.ToString & "' WHERE imgURL='" & ListBoxImgURL.Text & "'" MySqlConn = New MySqlConnection MySqlConn.ConnectionString = "server=10.1.1.10;userid=enkel;password=e032187;database=part_storage" Dim SDA As New MySqlDataAdapter Dim READER As MySqlDataReader Dim bSource As New BindingSource Try MySqlConn.Open() COMMAND = New MySqlCommand(QueryUpdate, MySqlConn) READER = COMMAND.ExecuteReader MySqlConn.Close() ProcessSuccessful3.Visible = True Catch ex As MySqlException MessageBox.Show(ex.Message) Finally MySqlConn.Dispose() End Try End Sub
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 'order='0' WHERE imgURL='2015_07_08-10_39_07am3.jpg'' at line 1




Reply With Quote
