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);
}
link|improve this question
What version of MySQL? What is your connection string? How are your columns defined (ie length/...)? – Joachim Isaksson 16 mins ago
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.