当前位置: 代码迷 >> ASP.NET >> 众人能移万座山,请高手来帮忙解题
  详细解决方案

众人能移万座山,请高手来帮忙解题

热度:7146   发布时间:2013-02-26 00:00:00.0
众人拾柴火焰高,请高手来帮忙解题
NO.   1     You   are   creating   an   ASP.NET   page   for   TestKing.   Employees   at   the   company   will   use   the   page
to   enter   suggested   names   for   new   products.   Each   suggestion   is   saved   in   a   Microsoft   SQL
Server   database.   The   table   in   the   database   for   suggestion   includes   the   following   three   columns.
Column   name   Content
EmployeeID   identification   number   of   employee   making   a   suggestion
ProductID   identification   number   for   the   product   being   named
Suggestion   suggested   name   for   product
To   add   a   suggestion   to   the   ASP.NET   page,   an   employee   logs   on   by   entering   the   appropriate
EmployeeID   and   password.   The   employee   then   uses   a   drop-down   list   box   to   select   a   ProductID
and   uses   a   grid   to   enter   suggested   names   for   that   product.   The   employee   can   enter   multiple
suggestions   for   a   single   products   before   submitting   the   page.
The   database   table   has   a   unique   index   that   includes   the   EmployeeID,   ProductID,   and
Suggestion   columns.   The   unique   index   does   not   allow   the   same   suggested   name   to   be   recorded
twice   for   the   same   product   by   the   same   employee.
You   are   using   a   SqlDataAdapter   object   to   insert   the   suggestions   into   the   database.   If   one   of   the
suggested   names   for   a   product   is   a   duplicate,   the   database   returns   an   error   to   your   code.   You
do   not   want   such   errors   to   interrupts   processing.   You   want   your   code   to   continue   inserting   any
remaining   suggestions   entered   by   the   employee.   You   also   want   to   be   able   to   access   a   list   of   any
suggested   names   that   were   skipped   due   to   errors.
What   should   you   do?    
A:     Create   an   event   handler   for   the   SqlDataAdapter   object’s   RowUpdated   event.
In   the   event   handler,   if   the   SqlRowUpdatedEventArgs   object’s   Errors   property   returns   a   nonnull
value,   then   set   the   SqlDataAdapter   object’s   ContinueUpdateOnError   property   to   true.  
B:     Create   an   event   handler   for   the   SqlDataAdapter   object’s   RowUpdated   event.
In   the   event   handler,   if   the   SqlRowUpdatedEventArgs   object’s   UpdateStatus   property   has   a
value   of   UpdateStatus.ErrorsOccured,   then   set   the   SqlDataAdapter   object’s
  相关解决方案