Results 1 to 2 of 2

Thread: Error Updating my database...

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Error Updating my database...

    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:
    1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    2.         Try
    3.             ContactsBindingSource.EndEdit()
    4.  
    5.             Dim rowsAffected As Integer = 0
    6.             rowsAffected = ContactsTableAdapter.Update(ContactsDataSet.Contacts)
    7.  
    8.             MessageBox.Show("You have updated " & rowsAffected.ToString & " rows in the datebase", "Rows Affected", MessageBoxButtons.OK, MessageBoxIcon.Information)
    9.  
    10.  
    11.         Catch ex As Exception
    12.             MessageBox.Show(ex.ToString)
    13.             TextBox9.Text = ex.ToString
    14.         End Try
    15.     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

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Re: Error Updating my database...

    Okay it's because my access datebase has a field type of attachemnt. How can I update a picture if I have added one to a picturebox.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width