Solved

Error when I updating...

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

621 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