Solved

Error when I updating...

Posted on 2006-10-25
4
201 Views
Last Modified: 2010-04-23
When I edit a column in the datagridview and hit save... i receive the following error...

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

here is the code ...

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

        Me.Validate()
        Me.TblTransactionBindingSource.EndEdit()
        Me.TblTransactionTableAdapter.Update(Me.DsRoomReservation.tblTransaction) '<--error is here

End Sub

DatagridView was binded to BindingSourceNavigator... Any ideas?

{Jack}
0
Comment
Question by:JackOfPH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17801495
It looks like you done have a usable update command for your adapter, this is the same kind of problem to one i had in Q http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_22023152.html

It describes creating a OLEDbCommandBuilder to create the commands for you.

It may be the same fix for you...?

Let me know how you get on...
0
 
LVL 15

Author Comment

by:JackOfPH
ID: 17801516
I am a new in vb.net I am using vb 2005 express edition...

How can I create OLEDbCommandBuilder when I use Table adapter?
0
 
LVL 15

Author Comment

by:JackOfPH
ID: 17801532
Hi, DJDezmond,

I agree, we have the same problem... but where should I place the OLEDBCommandBuilder? I use TABLEADAPTER?

Waiting for your post ...
Thanks...

{Jack}
0
 
LVL 9

Accepted Solution

by:
DjDezmond earned 500 total points
ID: 17801577
Just before you fill your table(s) from the adapater...

In my code...

   Sub InitializeStores()
        DBAdapter = New Data.OleDb.OleDbDataAdapter("SELECT * FROM tblTunes", DBConn)
        Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(DBAdapter )                '<------------------
        DBAdapter.Fill(DataStore)
    End Sub

Replace DBAdapter for TABLEADAPTER.

You may have to post your code if you still struggle so I can see how your initializing the adapter (at the moment I am assuming that your 'tableadapter' is in fact declared as a DBAdapter)

Dez
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question