Solved

VB .Net Unbound Datagrid update the database help?

Posted on 2003-12-12
1
966 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
Comment Utility
use this just before updating

dim build as new sqlclient.SQLCommandBuilder(m_da)

   m_da.Update(m_ds, "mytestds")
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

9 Experts available now in Live!

Get 1:1 Help Now