I am getting this error message:
--------------------------- 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 '(title) VALUES (hi)' at line 1
--------------------------- OK
And yeah, I know it's something to do with the syntax. The problem is, I have tried many variations of it and still can't get it to work, so then I went to 5 sites I found on google with tutorials, and still the same problem. Here's my code below:
Note: The values inside the Text Property of the text box controls listed below is just plain text, all letters and numbers.
try
{
label1.Text = "Trying to save. Wait.";
conn.Open();
string sql = "UPDATE " + pagelist.Text + "SET " + itemlist.Text + "=" + sitetext.Text;
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sql, conn);
cmd.ExecuteNonQuery();
}
catch (Exception en)
{
MessageBox.Show(en.Message);
}
About the table:
table has 3 columns "heading, title and text". all are varchars and the length of each one is 255
Can someone please help me figure out what's wrong about this? Any help at all is appreciated.
Thank you