Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB .Net Unbound Datagrid update the database help?

Posted on 2003-12-12
1
Medium Priority
?
1,023 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 500 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

609 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