I'm not sure what you need to see to help this error but this is my button update click event code and my error. i'm just trying to update my database.
Can someone please help ???
vb.net Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Try ContactsBindingSource.EndEdit() Dim rowsAffected As Integer = 0 rowsAffected = ContactsTableAdapter.Update(ContactsDataSet.Contacts) MessageBox.Show("You have updated " & rowsAffected.ToString & " rows in the datebase", "Rows Affected", MessageBoxButtons.OK, MessageBoxIcon.Information) Catch ex As Exception MessageBox.Show(ex.ToString) TextBox9.Text = ex.ToString End Try End Sub
Code:System.Data.OleDb.OleDbException: An UPDATE or DELETE query cannot contain a multi-valued field. at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataTable dataTable) at Phone_Book.ContactsDataSetTableAdapters.ContactsTableAdapter.Update(ContactsDataTable dataTable) in C:\Documents and Settings\Me\My Documents\Visual Studio 2008\Projects\Phone Book\Phone Book\ContactsDataSet.Designer.vb:line 1199 at Phone_Book.Form1.Button2_Click(Object sender, EventArgs e) in C:\Documents and Settings\Me\My Documents\Visual Studio 2008\Projects\Phone Book\Phone Book\Form1.vb:line 14




Reply With Quote