“Specified cast is not valid” when populating DataTable from OracleDataAdapter.Fill()
问题 I can't seem to find this question anywhere on Google (or StackOverflow), which really surprised me, so I'm putting it on here to help others in the same situation. I have a SQL query which runs fine on Oracle Sql Developer, but when I run it through C# using adapter.Fill(table) to get the results, I get Specified cast is not valid errors ( System.InvalidCastException ). Here is cut-down version of the C# code: var resultsTable = new DataTable(); using (var adapter = new OracleDataAdapter(cmd