After taking a break and rewatching the code i found the mistake. See Answers. Thank you for your help.
Questions left:
- Why didn't it give me an exception on most numbers? // I was not able to see the results. I just know that there was no exceptions on the others.
- Why does the DataSetDesigner cast that integer (datbase) to a string in the generated class?
I am using the Visual Studio 2017 / Oracle DataSet Designer to get classes inside my application that represent my database. Since Oracle doesn't support Visual Studio 2017 yet I use Visual Studio 2015 to generate my .xsd DataSets.
Using the code below I am getting a weird exception message.
For Each numberRow As myOracleDataSet.CustomerTelNumberRow In numberTbl.Select("customerID = " & row.CustomerID)
// Some more code
Next
System.InvalidArgumentException:
Min (551) must be less than or equal to max (-1) in a Range object.
Separating the In
-clause I found, that the exception occures on the DataTable.Select
call.
CutomerID
is a String-Property
given by the dataset designer and was checked for DBNULL
before the select. Code works fine if DataSet.Select
is executed with "1=1"
or "CustomerID = CustomerID"
. I also checked the value of CustomerID and found out the exception occurs, when the given CustomerID is 250
. Using a hard coded 250 instead of row.CustomerID gave me the same exception. So it probably has to do with the Data inside my Table. What can I do against it?
My String syntax should be correct since it's working for other IDs and the .Select-Method is not generated by myself.
I found the almost same exception on MSDN support.microsoft.com, but there it says that its only for .NET Framework 3.5-based applications
. My application is using .NET Framework 4.5.2 .