Given the information: Emp table has 10 records.
Given the code fragment:
Which code fragment, inserted at Line n1, helps you determine the number of records in ResultSet?
Given the information: Emp table has 10 records.
Given the code fragment:
Which code fragment, inserted at Line n1, helps you determine the number of records in ResultSet?
The correct way to determine the number of records in a ResultSet is to iterate through the ResultSet and count the rows. The provided code fragment `int totRows=0; while(rs.next()){ totRows++; }` correctly iterates through the ResultSet, counting each row, and thus provides the accurate count of records. Methods like `getRowCount()` or `getRowId()` are not defined for ResultSetMetaData or ResultSet in this context, making them incorrect for this purpose.
Answer B. Tested
getRowCount() is undefined for the type ResultSetMetaData Ans. B
also undefined for the type ResultSet
B is correct.
B is correct