0

I am using .NET framework 4.6.1 in a F# project. In earlier version, I could use a SqlCommandProvider which would call a stored procedure (which accepts a table-valued parameter). But recently it is showing an error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

System.InvalidCastException: Unable to cast object of type 'System.Object[]' to type 'Microsoft.SqlServer.Server.SqlDataRecord'.

at System.Linq.Enumerable.d__97`1.MoveNext()

The code has not been changed, just the .NET version or F# runtime version. I guess, the method cannot convert my table-value args to required SQL type. I have also tried SqlProgrammabilityProvider with no luck.

Any suggestion?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Khalid Saifullah
  • 747
  • 2
  • 8
  • 21

1 Answers1

1

It was multiple versions of FSharp.Data.SqlClient. One project was using 1.8.2 and a newer project of same solution was using 1.8.6. I forced both to be 1.8.2

But the error message is weird.

Khalid Saifullah
  • 747
  • 2
  • 8
  • 21
  • You might change the question to reflect the error instead of what you were trying to do, since the fact that it was a stored procedure with a table-valued parameter is not relevant – Overlord Zurg Nov 27 '18 at 22:26