After changing more than four coloumns in a dataset I get MySQL exception when updating the database. As long as there are only four or less coloumns that needs updating there is no problem. I am at loss, any pointers are welcome.
Code:
try
{
String s = "idcontacts = '" + id + "'";
Console.WriteLine(s);
DataRow[] contactsRow = ds.Tables["contacts"].Select(s);
contactsRow[0]["firstname"] = txtFirstName.Text;
contactsRow[0]["lastname"] = txtLastName.Text;
contactsRow[0]["adress"] = txtAdress.Text;
contactsRow[0]["postcode"] = int.Parse(txtPostcode.Text);
contactsRow[0]["city"] = txtCity.Text;
contactsRow[0]["phonenumber"] = int.Parse(txtMobilePhone.Text);
contactsRow[0]["email"] = txtEmail.Text;
da.Update(ds, "contacts");
MessageBox.Show("Changes saved", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
emptyAllFields();
}
catch (MySqlException ex)
{
Console.WriteLine(ex);
}