Multiple choice technology programming languages

You have following two code segments to read records from flat-file/excel: Code segment 1: OleDbConnection con; con = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(filename) + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\""); Code segment 2: OleDbConnection con; con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties=Excel 8.0;"); Which one of following is true:

  1. both can create connection to excel and flat files

  2. only second can create connection to excel

  3. first one can create connection to both excel and flat files, whereas second one can craete connection only to Excel

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Code segment 1 uses Text provider for CSV/text files with delimiters. Code segment 2 uses Excel 8.0 provider specifically for Excel files. Only segment 2 can create Excel connections. Segment 1 is for flat files (CSV), not Excel. Therefore only the second can create Excel connections.