473,395 Members | 1,905 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,395 software developers and data experts.

Saving an updated dataset back to the database

1
Hi,

I'm trying to write a Webapplication in ASP.Net 3.5 and C#.

I read data from a database and Bind it to a FormView using

Expand|Select|Wrap|Line Numbers
  1. <%# Eval("Columname") %>
Which works quite well. But I have no idea how to save the changes back to the database. Well, I think I can use the dataadapter.update function, but I don't know how to call it before my page does a postback and loose all my changes.

How do I save things back to a database??

Thanks,
Mattias
Aug 11 '08 #1
1 968
Curtis Rutland
3,256 Expert 2GB
Ok, well if you are doing your binding in your codefile's Page_Load method, make sure that you surround it with
Expand|Select|Wrap|Line Numbers
  1. if(! Page.IsPostBack)
  2. {
  3. //here's where your binding goes
  4. //this is C#, but you get the picture
  5. }
  6.  
That will prevent your changes from being lost on postback.

You need to make sure that your DataAdapter has a Update and (possibly) an Insert command. You can automatically generate these commands using a CommandBuilder.

Take a look at this article to see an example of the CommandBuilders.

Then you should be able to use the Update command.
Aug 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Oldhandandy | last post by:
I have a datagrid linked to a SQL Stored Procedure, the data is extracted from 4 tables. Data is only updated not inserted and the update is to only 1 of the tables, the other three tables are...
4
by: Frnak McKenney | last post by:
I'm using an in-core DataSet as an image of my application's 'database' (a multi-table Access97 mdb file). Updates are made to the DataTables within the DataSet via forms with bound TextBoxes,...
5
by: adrin | last post by:
hi, i am writing a program that is supposed to create a database of my music and albums. i want it to consist of 3 'modules' input<->processing<->output. input should enable reading data from cd...
7
by: Shaine Fisher | last post by:
I have had a look around but I'm either not finding or not seeing the answer to this, what i want to do is reurn the results as an array, or some other worldly useful format that flash mx2004 can...
1
by: Nikhil Patel | last post by:
Hi, I bind a grid to a DataView object. I lose the reference to the underlying DataTable and the DataSet in a postback. Here is the code. Page_Load works fine and I am able to see the rows in...
1
by: harriegovin | last post by:
Hi, Here is the scenario. I have a web application written in vb.net. One of the functionalities of the application is to save the recordset in an xml format on to the client machine. The xml...
6
by: x5Rb | last post by:
Database: 2 parent tables + 1 child table (child of both parent tables), enforcing foreign key constraints App: winformsapp, stuff (dataset, datatables, tableadatpers) generated by designer ...
5
by: Lucvdv | last post by:
This would better be described by 'serialization' than 'interop', but I didn't find a newsgroup that seems closer on topic. The problem in a few words: I save data with DataSet.WriteXML, but I...
1
by: romcab | last post by:
Hi guys, I would like to ask your help about saving in ado.net. I was able to update it only on the display but when I check the database, it is not updated. I paste below my code and hopefully...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
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,...

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.