Question:You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You plan to add a custom parameter in the SqlDataSource control.
You write the following code fragment:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
InsertCommand="INSERT INTO [Employee] ([Field1], [Field2], [PostedDate])
  VALUES (@Field1, @Field2, @PostedDate)">
 <InsertParameters>
  <asp:Parameter Name="Field1" />
  <asp:Parameter Name="Field2" />
  <custom:DayParameter Name="PostedDate" />
 </InsertParameters>
</asp:SqlDataSource>

You write the following code segment to create a custom parameter class:

public class DayParameter : Parameter { }

You need to ensure that the custom parameter returns the current date and time.
Which code segment should you add to the DayParameter class? 

A protected DayParameter()
     : base("Value", TypeCode.DateTime, DateTime.Now.ToString()) {

B protected override void LoadViewState(object savedState) {
  ((StateBag)savedState).Add("Value", DateTime.Now);

C protected override object Evaluate(HttpContext context, Control control) {
 return DateTime.Now;

D protected override Parameter Clone() {
 Parameter pm = new DayParameter();
 pm.DefaultValue = DateTime.Now;
 return pm;

+ Answer
+ Report
Total Preview: 1187

Copyright © 2024. Powered by Intellect Software Ltd