473,772 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with dataset in .NET 2.0 Update requires a valid UpdateCom

Hi All,

I have a typed dataset on a Windows form on Smart Device Application that
displays data from a Sql Server Mobile database.

The problem is, whenever I want to add a new record I first make a call to:

myTableBindingS ource.AddNew();

and this inserts a blank row.

When I've completed editing I make a call to:

myTableBindingS ource.EndEdit() ;
myTableTableAda pter.Update(myD ataSet.myTable) ;

and this works fine, no problems at all.
However, when I load the form and want to edit an existing record and not
add a new one... the Update command fails with:

"Update requires a valid UpdateCommand when passed DataRow collection with
modified rows"
I'm pretty sure this is something pretty basic I've missed. I've tried
making calls to myDataSet.myTab le.AcceptChange s() but this doesn't work
either. I know that it's because the Update statement on the
myTableTableAda pter object isn't being initialized correctly.

Does anyone know how to make sure the Update command is generated correctly
and the changes can be persisted back into the database?

Thanks,

Shaun O'Callaghan

Jun 7 '06 #1
1 1537
Bear in mind that when you are using SQL mobile the database path that you
set is in the mobile device and not your development machine.

chanmm

"Shaun O''Callaghan" <Sh************ *@discussions.m icrosoft.com> wrote in
message news:95******** *************** ***********@mic rosoft.com...
Hi All,

I have a typed dataset on a Windows form on Smart Device Application that
displays data from a Sql Server Mobile database.

The problem is, whenever I want to add a new record I first make a call
to:

myTableBindingS ource.AddNew();

and this inserts a blank row.

When I've completed editing I make a call to:

myTableBindingS ource.EndEdit() ;
myTableTableAda pter.Update(myD ataSet.myTable) ;

and this works fine, no problems at all.
However, when I load the form and want to edit an existing record and not
add a new one... the Update command fails with:

"Update requires a valid UpdateCommand when passed DataRow collection with
modified rows"
I'm pretty sure this is something pretty basic I've missed. I've tried
making calls to myDataSet.myTab le.AcceptChange s() but this doesn't work
either. I know that it's because the Update statement on the
myTableTableAda pter object isn't being initialized correctly.

Does anyone know how to make sure the Update command is generated
correctly
and the changes can be persisted back into the database?

Thanks,

Shaun O'Callaghan

Jun 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1212
by: Elmo | last post by:
I've got a situation where I'm trying to fix an existing table - - The Fname Field has both First & Last Names... So - I've populated a Dataset with the ID, First and Last names - - - I'm iterating through the datatable, Fixing the datat and assigning the First and Last name to variables, which I then, want to use to update the first and last name fields with. I keep getting an error when I try to do the Update on the row:
14
2264
by: Venkat Chellam | last post by:
I have a peculiar problem. I have a simple web application which loads some data from the oracle table and display in the datagrid in the webpage and datagrid has page enabled which shows 10 rows at a page.I have a search criteria to search the records based on the data range i give This is what i have done, in the !IsPostBack section. I am setting up the oracle connection, creating dataset object, datadapter and i aslo load the data...
0
1045
by: @piranha | last post by:
hello, when i'm trying to save changed data from the dataset to datasource(an excel file) i get this error 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. i use this code (straight from msdn)
11
8413
by: tomp | last post by:
Hi, I am trying to insert a row into the Categories Table in Nothwinds database in MSDE. I am able to manually insert it using a query tool. Using the Debugger, it appears the DataSet loads correctly, the Data Row is populated correctly, and the new row is added to the DataSet. But the database is not updated. What am I missing?
4
1855
by: Jeremy | last post by:
My app is throwing an exception regarding trying to post a null to a required field. Examining the datarow in question, I see a valid date value. The row's state is "added" I'm relying on an oledbcommandbuilder to supply the missing insert or update commands. The following shows how I'm creating my components: Private mdaCertByID As New OleDbDataAdapter 'selects a single cert by ID. .... mdaCertByID.SelectCommand = New OleDbCommand
7
3364
by: Jean Christophe Avard | last post by:
Hi! I have a dataset that retreive all the item information from the database. I need to be able to edit them, in the dataset and in the database. I have this code, could anyone tell me if I'm in the good way, cause I build that code from a book example, but nothing works. I HAVE THIS CODE TO SAVE THE CHANGE OF THE DATASET dstPlant.Tables("plant").Rows(intEditRow)("latin_name") = "KLHJJKJKJKHHHHHH"
1
2867
by: mikalush | last post by:
is anyone know if i can update access database with dataset in the vs 2005 express? really imortant to me. i need to know maybe i just wasting my time! i've a datagridView that get is data from a dataset: Me.T_1TableAdapter.Fill(Me.T_1DateSet.T_1)
2
2933
by: explode | last post by:
I made nova oledbdataadapter select update insert and delete command and connection veza. dataset is Studenti1data, I made it by the new data source wizard,and made datagridview and bindingsource draging Table1 to Form2. The select command works fine, but when I change the data and call update command I get a syntax error: System.Data.OleDb.OleDbException was unhandled ErrorCode=-2147217900 Message="Syntax error in UPDATE statement."...
5
2178
by: explode | last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As String) that creates a new oledbDataAdapter with insert update select and delete commads. I also added that commands can change depending how many columns are in a Table. I add a new column with this code: Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Try...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.