troubleshooting Question

SQL 'Round' fucntion does not work in Gridview Datasource???

Avatar of glasstree
glasstree asked on
Microsoft SQL Server.NET ProgrammingASP.NET
6 Comments1 Solution636 ViewsLast Modified:
Hello Experts,

I'm using "round" function in an SQL query to show the decimal number with 2 decimal points which is originally 4 decimal points in the database table.
Select round(price,2) From tbl_example

And this query shows up the perfect results as 50.00,55.00 & so on...when I run it on SQL server 2005 Management Express.
But when I try to copy and paste the same query in the DataSource of my GridView and test the query it just shows up all the numbers with 4 decimal points, It doesn't truncate the number to 2 decimal points for some reason.

Can you help me with this issue?

Is there any way I can  store all the decimal numbers in the database table itself as 2 decimal points instead of using round function each and every time to display results?

I tried going to table design and set datatype of my decimal number to "decimal(8,2), but it just gets overwritten with "decimal" datatype...

I need help with this issue urgenty.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros