473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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:

myTableBindingSource.AddNew();

and this inserts a blank row.

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

myTableBindingSource.EndEdit();
myTableTableAdapter.Update(myDataSet.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.myTable.AcceptChanges() but this doesn't work
either. I know that it's because the Update statement on the
myTableTableAdapter 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 1515
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.microsoft.com> wrote in
message news:95**********************************@microsof t.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:

myTableBindingSource.AddNew();

and this inserts a blank row.

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

myTableBindingSource.EndEdit();
myTableTableAdapter.Update(myDataSet.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.myTable.AcceptChanges() but this doesn't work
either. I know that it's because the Update statement on the
myTableTableAdapter 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
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...
14
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...
0
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...
11
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...
4
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 ...
7
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...
1
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...
2
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...
5
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.