VB.NET 2005 thick app querying Excel spreadsheets
I'm using the following code snippet to query an Excel spreadsheet for unique values in a given column. I want the query to be case sensitive (i.e. return 2 rows if values of "Test" and "test" are found). Any suggestions?
I'm using the following code snippet to query an Excel spreadsheet for unique values in a given column. I want the query to be case sensitive (i.e. return 2 rows if values of "Test" and "test" are found). Any suggestions?
Code:
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & s_strExcelFile & "; " & _
"Extended Properties=Excel 8.0;"
strSQL = "SELECT [" & FieldName & "], " & _
"Count([" & FieldName & "]) as DataCount " & _
"FROM [TheData] " & _
"GROUP BY [" & FieldName & "] " & _
"ORDER BY Count([" & FieldName & "]) DESC"
objConnection = New System.Data.OleDb.OleDbConnection(strConnection)
objDataAdapter = New System.Data.OleDb.OleDbDataAdapter(strSQL, objConnection)
objDataSet = New System.Data.DataSet
objDataAdapter.Fill(objDataSet)