Sql Query and Double Var Values
Im having an issue with a certain query,
Dim nwLat As Double
Dim Ssql As String
nwLat = nwLatHidden.Value
Ssql = " select * from customer where latitude < " & nwLat
TFRcount.SelectCommand = Ssql
TFRcount.SelectParameters.Clear()
TFRcount.DataBind()
All it does is refresh the page an开发者_开发问答d does nothing; it should populate a chart. However when I replace nwLat
with a value (eg where latitude = 56) it works perfectly and populates the chart. Any ideas what's wrong with nwLat
?
EDIT: I switched nwLat
to long and it works; however it only takes the number up to the decimal and ignores the rest. Any way to fix? (eg as double 56.764746 and long 56)
Are you sure nwLatHidden has a value?
Try this:
nwLat = 56
If NOT string.isnullorempty(nwLatHidden.Value) THEN
nwLat = nwLatHidden.Value
Or just put a debugger break in there, run the code to the break, and then mouse-over newLat to see what it's value is.
Don't use mixed mode operations, use
Ssql = " select * from customer where latitude < " & cstr(nwLat)
精彩评论