?
Solved

How to convert nvarchar to float in vb.net?

Posted on 2012-09-07
3
Medium Priority
?
1,235 Views
Last Modified: 2012-09-07
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
Comment
Question by:developer2012
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 1500 total points
ID: 38376999
Why are you converting salary to a varchar and then casting to a float?
0
 

Author Closing Comment

by:developer2012
ID: 38377171
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
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 38377521
You are welcome - would be interested to know what the issue was but glad you got sorted.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question