Solved

VB .Net Unbound Datagrid update the database help?

Posted on 2003-12-12
1
1,000 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
[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
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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