S
Shan1986
Guest
Hi,
I have a data table with two columns product and size. when user inputs a size , i want to find a closest size or exact size according to user input.
I am trying to find using a following code but it does not work as expected. any help?
Dim userInput as double = 1.2
Dim closest = XML_DS.Tables("tbl_ProdSIZE").[Select]().OrderBy(Function(dr) Math.Abs(CInt(dr("Size")) - userInput)).FirstOrDefault()
I have a size values of 1.0, 1.4, 1.5 . Expected result should be 1.0.
Thanks
Continue reading...
I have a data table with two columns product and size. when user inputs a size , i want to find a closest size or exact size according to user input.
I am trying to find using a following code but it does not work as expected. any help?
Dim userInput as double = 1.2
Dim closest = XML_DS.Tables("tbl_ProdSIZE").[Select]().OrderBy(Function(dr) Math.Abs(CInt(dr("Size")) - userInput)).FirstOrDefault()
I have a size values of 1.0, 1.4, 1.5 . Expected result should be 1.0.
Thanks
Continue reading...