Which code segment should you use?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

The application uses the following LINQ query.

var query = from o in orderLinesQuery
where (string)o["CarrierTrackingNumber"] == "AEB6-4356-80"
select new
{
SalesOrderID = o.Field<int>("SalesOrderID"),
OrderDate = o.Field<DateTime>("OrderDate")
};

The CarrierTrackingNumber field in the DataRow is nullable. You need to ensure that an exception does not occur if the CarrierTrackingNumber field has a null value.

Which code segment should you use?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

The application uses the following LINQ query.

var query = from o in orderLinesQuery
where (string)o["CarrierTrackingNumber"] == "AEB6-4356-80"
select new
{
SalesOrderID = o.Field<int>("SalesOrderID"),
OrderDate = o.Field<DateTime>("OrderDate")
};

The CarrierTrackingNumber field in the DataRow is nullable. You need to ensure that an exception does not occur if the CarrierTrackingNumber field has a null value.

Which code segment should you use?

A.
var query = from o in orderLinesQuery
where !o.IsNull("CarrierTrackingNumber") &&
(string)o["CarrierTrackingNumber"] == "AEB6-4356-80"
select new
{
SalesOrderID = o.Field<int>("SalesOrderID"),
OrderDate = o.Field<DateTime>("OrderDate")
};

B.
var query = from o in orderLinesQuery
where o.IsNull("CarrierTrackingNumber") &&
(string)o["CarrierTrackingNumber"] == "AEB6-4356-80"
select new
{
SalesOrderID = o.Field<int>("SalesOrderID"),
OrderDate = o.Field<DateTime>("OrderDate")
};

C.
var query = from o in orderLinesQuery
where o.Field<string>("CarrierTrackingNumber") == "AEB6-4356-80" select new
{
SalesOrderID = o.Field<int>("SalesOrderID"),
OrderDate = o.Field<DateTime>("OrderDate")
};

D.
var query = from o in orderLinesQuery
where (string)o["CarrierTrackingNumber"] == DbNull.Value &&
(string)o["CarrierTrackingNumber"] == "AEB6-4356-80"
select new
{
SalesOrderID = o.Field<int>("SalesOrderID"),
OrderDate = o.Field<DateTime>("OrderDate")
};



Leave a Reply 0

Your email address will not be published. Required fields are marked *