.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to update dataset?

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
Hi,As DataSet is disconnected how to update data modified in a DataSet back into the datbase. Like when selecting we usedataProvider.fill(dataSet) so how to update the modified data in a DataSet using DataProvider?Thanks

View Complete Post

More Related Resource Links

How to update Sql Server related tables from Dataset(SchemaFill)

Hi!I would like to update new records that get inserted in DataSet to Sql Server Database.Below is a working example of how to do this if you use "DataAdapter.Fill(ds)". But i don't want to fill data, becouse i don't need data, i only need shema (I will use this dataset to insert new data to Sql), so i would like to use "DataAdapter.FillSchema(ds)"Please help me out at least with this one... i'm stuck... can't continue untill i crack this nut.<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td> <asp:GridView ID="GridView1" runat="server" ShowHeaderWhenEmpty="True"> <Columns> <asp:CommandField ShowSelectButton="True" /> </Columns>

Why does reporting services always fails to update dataset rows?

Greetings I am working on a project, i must provide reports via Reporting Services. 2008. Problem is, it is for some reason almost always falsely declaring my query as a bad one (must declare something that IS declared, or wrong use of operator minus when its NOT wrong).  For example, i have a query with parameters @sd and @ed (start date and end date). I intend to let user set @ed to null, in that case, the month of @sd is used. So, first lines of query look like this: IF (@ED IS NULL) BEGIN SET @sd=DATEADD(dd,1-(DAY(@sd)),@sd); SET @ed=DATEADD(dd,-(DAY(DATEADD(mm,1,@sd))),DATEADD(mm,1,@sd)); END   And then it fails to see that @sd is a parameter, instead it spits like 5 times "must declare @sd" and refuses to refresh list of rows. Same happens with other queries. For example, i keep getting the "Operand data type nvarchar is invalid for minus operator" on a 100% correct query. And with others. Those are 100% legit, work in sql management studio as well as they work after i click "continue" at error message and compile a report.   So far this seems like a major bug to me. Or am i doing something wrong?

Using XML Scheme (XSD) to update empty XML produced Dataset elements with a default value



I'm trying to build a dataset out of an XML File and an XSD scheme file, but I need the Scheme to change some of the data in the XML DataSet.

For example, I have an empty field in the XML file ("<Price></Price>") but I need my dataset to contain a decimal value of 0.0 for this field if the XML tag is empty. I need to somehow change the value in the dataset in these case to 0.0. When trying to use a decimal element in the XSD scheme, I get the "Input string was not in a correct format" error because it's trying to convert an empty string to decimal. Strangely, if this was an int, there wouldn't be an error..

The commands I'm using are simply:




The XSD scheme has the "default" and "fixed" attributes, but as far as I understand, they only take place when the tag is missing from the XML File, not when it is empty.

The ultimate goal is to have a XML generated dataset with the correct decimal type and default value of 0 when the XML has an empty tag.


 Can anyone please help?

Update a table from a dataset



I have a data flow task in which I have a dataset containing some rows and now I want to update the rows in a table, not insert them. Is there any way to do that in the task?



Adding rows to a databound DataSet/DataTable from a ThreadPool thread does not update UI


I have an WPF .NET 4.0 application which creates a TreeView in the main thread, and databinds it to a DataSet which contains two DataTables. The datatables have a simple relationship between them which represents a two-level tree. When the treeview is initially drawn, it correctly displays all items from the two datatables as a two level tree.

When the DataTables are updated from the UI thread (add/delete/modify a row), the treeview is refreshed and the changes to the databound DataSet DataTables are visible in the treeview.

If changes to the DataTables are made from a ThreadPool thread, no exceptions are thrown, but the UI is not updated. I am using a threadpool thread because the changes will be initiated from multiple network devices and processing their data is fairly CPU intensive.

I am assuming that change notifications are not being propogated across threads for DataSets/DataTables.  Is this assumption correct? If so, are their recommended best practices to overcome this limitation?

Merge two .sdf databases files, and SqlCeDataAdapter.Update(dataset) not working,

Hello You'll, I have two .sdf databases that I need to merge them. So, I loaded the data from the two files into datasets and then called the dataset.merge()function. Now, I have the merge dataset ready but I am not sure how I am going to update the sdf file from the dataset. Please help I have been trying for a while . The problem is how do I get the data in the dataset into the sdf file. I did use the SqlCeDataAdapter.update(Dataset) but I am getting the following error (" Update unable to find TableMapping['Table'] or DataTable 'Table') using VS 2010 and C# SqlCE 3.5, Thanks in advance, Sean

ASP.Net Gridview Edit Update Cancel Commands

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Introducing ADO.NET and the Typed DataSet

In reviewing the applications it seemed everything they were doing involved database reads, writes, and manipulation. The development staff had been reviewing the articles and code samples for ADO.NET. They had spent many years refining their existing ADO based infrastructure and perfecting their use of ADO

Create and Use a Typed DataSet by Using Visual C# .NET

This article shows you how to create and use a typed DataSet in a small Web application. Typed DataSets, which inherit from the DataSet class, create first-class members of a DataSet's DataTables and DataColumns, yielding the many benefits that come with the use of strong typing.

Update Vs SystemUpdate

Many of you might noticed that share point ListItem has Update() method as well as SystemUpdate().

What is the difference between these two methods and why MOSS has two different APIs for updating an ListItem

Get Top 1 Record from Dataset

Many of them in need of getting the Top 1 or Top 10 records from a Dataset without going to SQL query. It is possible to do from Code Behind. I have given the code below,
The below code is to get single record from a Dataset. Also I have given for getting 8 records at Green Color.

Returning a DataSet From a Web Services: Step-by-Step

This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.


This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

>>>How to update multiple rows of gidview by one click



I want to add multiple rows of a gridview if the data for multiple fields are same.

Idea for this is that a user may search a record with some parameter e.g. Sector, plot.

For example 15 records being displayed in gridview.

There should be checkbox before every row and if user wants to update Plot and Flat No that is same for 10 rows out of 15 so he will check the rows and update.

For this a dialog box should appear asking for the parameter i.e. Plot and Flat or something else next time may be it will be City or country. Moreover, there is already an Edit button to update records, when user click it another page open for the record to be updated and whatever he wants to update, it updates.

Hope everone understand the scenario.

I don't want to disturb the already provided Edit functionality and want to provide same record to be updated.

Any idea in this regard would be appreciated.

Visual Studio closes itself by opening aspx-Page designer after Windows Update


Hey Guys,

I've a problem with my Visual Studio.

On the 13th of August 2010 i installed a Windows update on my vista sp2 pc. For this date my Visual Studio 2008 sp 1 always has closed itself by opening an aspx-page in designer view. There is no error message just closing the window. I restored a backup of my windows from the time before updating it and it helped, i could open aspx pages in the design view till the update has been installed again automatically after rebooting the pc. I can't disable windows updates, cause it's my pc at work and safety is very important. I hope you could help me out of this disaster.



Persist large dataset across ASP.NET pages. No database


Can anyone give me suggestions on how to implement the following requirement?

1. A online wizard (step-by step operation) processes user requests across several ASP.NET pages.  The session data is stored in memory until the user submits the request.  Once the request is submitted, a XML file is created and the data are passed to XML.

# Case Study: The parent page has a "select" button.  Click "select" will pop up a child page.  The users can select 1000+ items from a datagrid in the child page.  Once the user clicks "confirm", the selected items in the child page will be populated to the selected item gridveiw in the parent page.  The user can keep selecting more in the child page and the selected items will be appended to the gridview in the parent page.


- What's the best way to extract strings from a text file and convert to a dataset in memory and then present it in a datagrid in UI?

- What's the best way to persist and manipulate a large dataset across pages?  Session? or ViewState? Can it be accomplished by LINQ?

The app doesn't interact with a DB.  Once the request is submitted, it will convert the in memory data to a XML file.  What technology can be used to accomplished this?&nb

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend