[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

Problem saving record using Validate/EndEdit

I'm trying to do something as simple as save a record bound to a dataset. This should be easier....


I'm getting the following error:

"Update requires a valid UpdateCommand when passed DataRow collection with modified rows."

Highlighting this line:

If Not Me.PendingTableAdapter.Update(Me.Phone_memo_backendDataSet.Pending) > 0 _
        Then


THANKS!
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
 
 
        Me.Validate()
        Me.PendingBindingSource.EndEdit()
        If Not Me.PendingTableAdapter.Update(Me.Phone_memo_backendDataSet.Pending) > 0 _
        Then
            MsgBox("No records were updated.")
        End If
        Me.Close()
 
    End Sub

Open in new window

0
c9k9h
Asked:
c9k9h
  • 2
1 Solution
 
CodeCruiserCommented:
The dataadapter is not configured properly. It is missing the update command. How did you create the dataadapter and the binder etc?
0
 
c9k9hAuthor Commented:
I did not use a wizard or anything....

This will be in a multi-user enviro. Will it be better to use standard SQL to perform the updates? I Know Access Jet has many issues with multiple users...
0
 
CodeCruiserCommented:
Access is mostly used in single user environments. If you did not use a wizard, you would have to create the other commands yourself. Use the commandbuilder class to generate other commands.

http://www.radsoftware.com.au/articles/usingcommandbuilder.aspx
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now