Solved

VB .Net Unbound Datagrid update the database help?

Posted on 2003-12-12
1
993 Views
Last Modified: 2006-11-17
Need some help updating the database from my datagrid.

The code that populates the grid is...
        m_da = New SqlClient.SqlDataAdapter(strSql, pStrConnection)

        m_ds = New DataSet("mytestds")
        m_da.Fill(m_ds, "mytestds")

        dgDH51.SetDataBinding(m_ds, "mytestds")
        cn.Close()

I was trying to update the db using ....

        m_da.Update(m_ds, "mytestds")

But I get this error. I am guessing what to do as I can't find any good examples.

An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll

Additional information: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.

Thanks
Andy
0
Comment
Question by:andy_booth
1 Comment
 
LVL 8

Accepted Solution

by:
Dranizz earned 125 total points
ID: 9927935
use this just before updating

dim build as new sqlclient.SQLCommandBuilder(m_da)

   m_da.Update(m_ds, "mytestds")
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Modal Popup Extender control 1 38
SQL Help 27 57
jQuery - following an example but can I save data server side? 20 58
transition to visual .net from vb6 5 37
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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