1

I cant seem to figure this out. The error I get is

"The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is >incorrect. Parameter 13 ("@10"): The supplied value is not a valid instance of data type >float. Check the source data for invalid values. An example of an invalid value is data of >numeric type with scale greater than precision."

I've checked every value for NaN. The database was created with code first. However, when I try to add some values using the dbcontext i get the error.

It might be related to the fact that the double values I'm trying to insert are generated by parsing strings with double.parse().

Any suggestions are appreciated! Thanks

Mason
  • 737
  • 2
  • 9
  • 23
  • 3
    Can you turn on a SQL profiler and see the generated sql? Might give you some hints. – Rick B Nov 13 '12 at 15:14
  • Thank you so much! I didn't know such a thing existed but when I found it it solved my problem! – Mason Nov 13 '12 at 16:14
  • See this thread on how to view the SQL generated for `SaveChanges`: https://stackoverflow.com/questions/16880687/how-can-i-log-the-generated-sql-from-dbcontext-savechanges-in-my-program – MikeH Nov 07 '17 at 00:10

2 Answers2

0

I was receiving the same error for a parameterized query. I found that the value I was trying to pass to the SqlCommand object was actually a value resulting from a division by zero. The error wasn't triggered by the actual division by zero calculation, the Double variable accommodated that by storing a value that looked like -1.#IND But then when I tried to pass that value to the SqlCommand object for the parameter specified in the error, then I got the error above when I tried to execute the query.

Eric Barr
  • 3,999
  • 5
  • 29
  • 42
-2

For anyone wondering, I found this: http://www.datawizard.com/ It lead me strait to my issue.

I think there is something like this built into some sql servers but mine didnt have it so I used this.

Thank you to Rick B for pointing me in the right direction!

Mason
  • 737
  • 2
  • 9
  • 23