Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error when I updating...

Posted on 2006-10-25
4
Medium Priority
?
205 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 2000 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

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.

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…
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 video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

718 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