• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1328
  • Last Modified:

How to convert nvarchar to float in vb.net?

Hello Experts,

I have the below query in vb.net application and it gives an error "Error converting varchar to float"


 SELECT  TOP 1 * FROM tblSystemEmployee WHERE Empid=" & Empid & " AND  CAST(CONVERT(VARCHAR(10),Salary,101) AS FLOAT) <" & Mp & " ORDER BY CAST(CONVERT(VARCHAR(10),Salary,101) AS FLOAT) DESC "

Open in new window


How do i resolve this?

Thank you!
0
developer2012
Asked:
developer2012
  • 2
1 Solution
 
Julian HansenCommented:
Why are you converting salary to a varchar and then casting to a float?
0
 
developer2012Author Commented:
Thanks!. I went back and checked the database schema. There were changes in it and I don't need  that query any more. Thanks for your comment....provoked me to research...
0
 
Julian HansenCommented:
You are welcome - would be interested to know what the issue was but glad you got sorted.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now