943,495 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 5438
  • ASP.NET RSS
Jun 16th, 2003
0

2 ASP Questions

Expand Post »
Just a couple of problems I'm working on-- can anyone help. Thanks.

1. You are making changes to an existing ASP.NET application. The application contains a DataSet object, dsProspect. The page you are changing displays prospect data from the dsProspect DataSet and includes an Update button. You define a new DataSet named dsStudent, and add this line of code to the Click event handler of the Update button:
dsStudent = dsProspect.GetChanges();

Which statement represents the result of executing this line of code?

A. The dsProspect DataSet will contain only modified rows
B. The dsStudent DataSet will contain all rows from the dsProspect DataSet.
C. The dsStudent DataSet will contain all modified rows from the dsProspect DataSet
D. An error will occur because the statement is not syntactically correct



2. Your ASP.NET application tracks donations for a non-profit agency. The application contains a Web Form, which displays all donations in a DataGrid control, DonorGrid. The data grid contains seven columns: lname, fname, donationdate, donationdesc, dtype, dsubtype, and damount.
Your data resides in a SQL Server 2000 database and is available through a DataSet, named dsDonor.
You want to allow users to sort the data in the grid. When a user clicks a button, you want the data in the grid to be sorted descending by damount, and then sorted alphabetically by lname and fname. You decide to use a DataView object to accomplish this.

Which code fragment should you use?

DataView dv = new DataView();
dv.Table = dsDonor.Tables[0];
dv.ApplyDefaultSort = true;
DonorGrid.DataSource = dv;
DonorGrid.DataBind();

OR

DataView dv = new DataView();
dv.Table = dsDonor.Tables[0];
dv.Sort = "damount DESC, lname, fname";
DonorGrid.DataSource = dv;
DonorGrid.DataBind();

OR

DataView dv = new DataView();
dv.Table = dsDonor.Tables[0];
dv.Sort = "lname, fname, damount DESC";
DonorGrid.DataSource = dv;
DonorGrid.DataBind();

OR

DataView dv = new DataView();
dv.Table = dsDonor.Tables[0];
dv.Sort[1] = "damount DESC";
dv.Sort[2] = "lname ASC, fname ASC";
DonorGrid.DataSource = dv;
DonorGrid.DataBind();
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bh_superman is offline Offline
1 posts
since Jun 2003
Jun 17th, 2003
0

Re: 2 ASP Questions

Sorry, I don't know ASP ... this is a question for either Tekmaven or for inscissor. I just thought I'd congratulate you on being our 500th member

You might want to check out all of the ASP resources we have links to ...
I know there are a few ASP tutorials / reference guides mixed in
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Jun 17th, 2003
0

Re: 2 ASP Questions

I feel like I'm doing your homework, but oh well...

For #1, the correct answer is choice C.
Here is an overview of the GetChanges() method: http://msdn.microsoft.com/library/de...angestopic.asp

For #2, I would go with choice 2.
Here is some information about the DataView ASP.NET Control http://msdn.microsoft.com/msdnnews/2...ng/Sorting.asp
Moderator
Reputation Points: 322
Solved Threads: 28
The C# Man, Myth, Legend
Tekmaven is offline Offline
914 posts
since Feb 2002
Dec 30th, 2010
-1
Re: 2 ASP Questions
I like your post, below your question answers
1). Correct answer is C (The dsStudent DataSet will contain all modified rows from the dsProspect DataSet)

Returns a copy of the DataSet that contains all changes made to it since it was loaded or AcceptChanges was last called.

2). Correct answer is 2. this is

DataView dv = new DataView();
dv.Table = dsDonor.Tables[0];
dv.Sort = "damount DESC, lname, fname";
DonorGrid.DataSource = dv;
DonorGrid.DataBind();

Reputation Points: 8
Solved Threads: 2
Newbie Poster
Shoaib Siddiqui is offline Offline
4 posts
since Dec 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: How can I create an excel file or XML from pdf bookmarks?
Next Thread in ASP.NET Forum Timeline: checkboxlist under gridview





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC