Solved

Error when I updating...

Posted on 2006-10-25
4
197 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now