Database Edit Update Error


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Database Edit Update Error

  1. #1
    Join Date
    Dec 2011
    Posts
    1

    Question Database Edit Update Error

    I am creating an ASP.NET website that has a multitier application that uses a WCF Service that allows for database updating (Contacts.mdf). I have been working my way through step-by-step instructions. GetContacts, DeleteContact, and InsertContact work. UpdateContacts does not.

    The error message that I am getting is:
    ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateContacts' that has parameters: Name, CompanyName, Address, City, State, Zip, Telephone, Fax, Original_PubID, PubID

    Code I am using:
    Code:
    in IContactsService:
    <OperationContract()> _
        Function UpdateContacts(ByVal Name As String, _
            ByVal CompanyName As String, _
            ByVal Address As String, ByVal City As String, _
            ByVal State As String, ByVal Zip As String, _
            ByVal Telephone As String, ByVal Fax As String, _
            ByVal Original_PubID As Integer) As Integer
    in ContactsService:
    Code:
    Public Function UpdateContacts(ByVal Name As String, _
            ByVal CompanyName As String, _
            ByVal Address As String, ByVal City As String, _
            ByVal State As String, ByVal Zip As String, _
            ByVal Telephone As String, ByVal Fax As String, ByVal Original_PubID As Integer) As Integer _
            Implements IContactsService.UpdateContacts
            ' Update the dataset.
    
            Try
                Dim ContactsTableAdapter As New  _
                    ContactsDataSetTableAdapters.PublishersTableAdapter
                ContactsTableAdapter.Update(Name, CompanyName, Address, _
                    City, State, Zip, Telephone, Fax, Original_PubID)
            Catch ex As Exception
                Throw ex
            End Try
        End Function
    I have set the ReadOnly property of PubID to false in the DataSet Designer and also using the smart tag of the DetailsView control -- Edit Fields.

    The code is straight out of a textbook, so I don't think it is that? A problem with the parameters Original_PubID, PubID that the service is looking for I think, but how to fix it? Suggestions please? TIA!

  2. #2
    Join Date
    Dec 2011
    Posts
    1
    I got this to work by using Pub_ID in the 3 places in the code where I had used Original_PubID before. I was concerned since Pub_ID had ReadOnly set to False, that perhaps if the user tried to change it in the update procedure, that it would throw an error. It did not. It left the Pub_ID as it was. So, all is good, except I'm not sure why the code didn't work as written in the textbook?

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2009, 10:22 AM
  2. Access Database Update and delete
    By hendrikbez in forum .NET
    Replies: 5
    Last Post: 04-02-2009, 04:43 PM
  3. Replies: 1
    Last Post: 08-19-2003, 01:12 PM
  4. Replies: 3
    Last Post: 05-10-2002, 08:09 AM
  5. I am helpless - Edit Info form
    By Dan in forum VB Classic
    Replies: 0
    Last Post: 03-17-2000, 06:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center