User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,813 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,487 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 3948 | Replies: 2
Reply
Join Date: Jun 2003
Posts: 1
Reputation: bh_superman is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bh_superman bh_superman is offline Offline
Newbie Poster

2 ASP Questions

  #1  
Jun 16th, 2003
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();
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,879
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 107
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: 2 ASP Questions

  #2  
Jun 17th, 2003
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
Reply With Quote  
Join Date: Feb 2002
Location: New York
Posts: 862
Reputation: Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light 
Rep Power: 12
Solved Threads: 15
Moderator
Tekmaven's Avatar
Tekmaven Tekmaven is offline Offline
The C# Man, Myth, Legend

Re: 2 ASP Questions

  #3  
Jun 17th, 2003
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
-Ryan Hoffman

ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 5:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC