.NETGURU
Updating a dataset from a datalist control
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.adonet.

Post a new message to this list...

ree32
I am using the editItem templates of the datalist control. I have a
problem as to transferring the changes made by the user to the
dataset.

As I am reading the results form a database to a dataset then using
the dataset to fill the datalist.
The problem is I am not sure how to transfer changes back to the
dataset as I plan on using the update method of the dataset to change
the database.

Is this possible? or do I have to use the clumsy way of creating an
sql string command to update the changes back to the database.

Thanks
Reply to this message...
 
    
Scott M.
Your DataList has an eventhandler for updates made to it (UpdateCommand, I
think). In this eventhandler, you would change the row of the dataset that
corresponds to the row of the DataList being edited.

When you are ready to update the database, you use the Update method of the
DataAdapter (not the DataSet) and, of course, you need to have configured
the DataAdapter's update command before calling DataAdapter.update.

"ree32" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
ree32
"Scott M." <Click here to reveal e-mail address> wrote in message news:<Click here to reveal e-mail address>...
[Original message clipped]

adapter is called in a separate function ( since this fuction is what
initially populates the datalist on the page before the user clicks an
edit button.
Reply to this message...
 
    
Scott M.
What do you mean "get control" of the DataAdapter. If it is declared at the
module level, you can work with it anywhere in your class.

"ree32" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
ree32
"Scott M." <Click here to reveal e-mail address> wrote in message news:<uKURw$Click here to reveal e-mail address>...
[Original message clipped]

What do you mean by the module level. I am only declaring the dataset
in the sub. So when I finish with the sub I would not be able to get
control of the dataset?

Are you saying the dataset should be declared just inside the class
declaration with all the the other asp web controls such as as
buttons, dropdownlists?
Reply to this message...
 
    
Scott M.
Yes, that is sometimes referred to as module level.

If you declare something there, you can use it in any other subs/functions
of that class.

"ree32" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Data.Common.DataAdapter
System.Data.DataSet
System.Web.UI.WebControls.DataList




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification