Solved

VB .Net Unbound Datagrid update the database help?

Posted on 2003-12-12
1
986 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 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