• 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!
  • 2
1 Solution
Julian HansenCommented:
Why are you converting salary to a varchar and then casting to a float?
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...
Julian HansenCommented:
You are welcome - would be interested to know what the issue was but glad you got sorted.
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