You create a Microsoft Windows SharePoint Services list named Books. The list has a column named Stock that stores the total number of available books.
You write the following code segment. (Line numbers are included for reference only.)
01 Protected Overloads Overrides Sub CreateChildControls()
02 Dim myWeb As SPWeb = SPControl.GetContextWeb(Context)
03 Dim myList As SPList = my Web .Lists(“Books”)
04 …
05 Dim myGrid As DataGrid = New DataGrid
06 myGrid.DataSource = results
07 myGrid.DataBind
08 Me.Controls.Add(myGrid)
09 End Sub
You need to render a list of books for which the value in the Stock column is less than 100.
Which code segment should you insert at line 04?
A.
Dim query As SPQuery = New SPQuery
query.Query = “<Where><Leq><FieldRef Name=’Stock’/><Value
Type=’Number’>100</Value></Leq></Where>”
Dim results As SPListItemCollection = list.GetItems(query)
B.
Dim query As SPQuery = New SPQuery
query.Query = “<Where><Leq><FieldRef Name=’Stock’/><Value _
Type=’Number’>100</Value></Leq/Where>”
Dim results As SPListItemCollection = list.GetChanges(query)
C.
Dim query As SPQuery = New SPQuery
query.Query = “<Where><Lt><FieldRef Name=’Stock’/><Value _
Type=’Number’>100</Value></Lt></Where>”
Dim results As SPListItemCollection = list.GetItems(query)
D.
Dim query As SPQuery = New SPQuery
query.Query = “<Where><Lt><FieldRef Name=’Stock’/><Value _
Type=’Number’>100</Value></Lt></Where>”
Dim results As SPListItemCollection = list.GetChanges(query)