Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

ExecuteReader: Input string was not in correct format (no replies)

$
0
0
I'm using the .Net connector and I keep getting this error:
"Input String was not in correct format"

Here is what I'm doing:

I have this query:
SELECT * FROM Orders WHERE OrderNumber = @OrdNumber

I have the proper statements set to define @OrdNumber as a parameter (of VarChar type).

So, when I run my script with @OrdNumber being 300100, it works fine, but when I try with something like 300f100, it fails giving me the error above.

I've also tried putting single quotes around @OrdNumber that that's fine, except for if a row with an order number of 300100 exists, it doesn't return any results for some reason, but when I remove the quotes and run it again with 300100 for the @OrdNumber parameter, it's fine.

Ideas on how to fix this? I need the parameter to be able accept both numbers or letters or both, and run properly (return the correct results).

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>