You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database. The database includes a database table named ProductCatalog as shown in the exhibit. (Click the Exhibit button.) You add the following code segment to query the first row of the ProductCatalog table. (Line numbers are included for reference only.)
01 Using cnx As var = New SqlConnection(connString)
02 Dim command As var = cnx.CreateCommand()
03 command.CommandType = CommandType.Text
04 command.CommandText = “SELECT TOP 1 * FROM dbo.ProductCatalog”
05 cnx.Open()
06 Dim reader As var = command.ExecuteReader()
07 If reader.Read() Then
08 Dim id As var = reader.GetInt32(0)
09
10 reader.Close()
11 End If
12 End Using
You need to read the values for the Weight, Price, and Status columns. Which code segment should you insert at line 09?
A.
Dim weight As var = reader.GetDouble(1) Dim price As var = reader.GetDecimal(2) Dim status As var = reader.GetBoolean(3)
B.
Dim weight As var = reader.GetDecimal(1) Dim price As var = reader.GetFloat(2) Dim status As var = reader.GetByte(3)
C.
Dim weight As var = reader.GetDouble(1) Dim price As var = reader.GetFloat(2) Dim status As var = reader.GetBoolean(3)
D.
Dim weight As var = reader.GetFloat(1) Dim price As var = reader.GetDouble(2) Dim status As var = reader.GetByte(3)