Showing posts with label point. Show all posts
Showing posts with label point. Show all posts

Wednesday, March 28, 2012

Link to another report on point labels in Pie Chart

Hello. I am new to SQL Server Reporting Services. The short explanation of what I want to do: In a pie chart, I have turned on point labels. I want each of the point labels to be a link. When you click on the link, you are taken to another report (in table format) that is more information about the data in that wedge of the pie.
If that is unclear, maybe it will help if I explain what I'm trying to do. The pie chart is a chart showing the status of developer issues in an issue tracking database. (Open, In-Progress, Awaiting Verification, Closed, Rejected, etc.) Each wedge of the pie has a point label that shows the number of issues that fall into the category (8 issues opened, 12 issues IP, etc.) When I click on the label that shows the number, I want to be taken to a table that shows what the issues in that category are.
Is this possible with SQL Server Reporting Services? Thanks in advance.Yes. Check out Chart Properties Dialog -> Values -> Edit -> Edit Chart Value
dialog box -> Action tab. You can choose Jump To Report option here and
specify the target report. You can also pass parameters to the target report
from this location.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Justin30519" <Justin30519@.discussions.microsoft.com> wrote in message
news:BC5B49B6-2B72-4D9C-A4B0-0CA3356E8114@.microsoft.com...
> Hello. I am new to SQL Server Reporting Services. The short explanation of
what I want to do: In a pie chart, I have turned on point labels. I want
each of the point labels to be a link. When you click on the link, you are
taken to another report (in table format) that is more information about the
data in that wedge of the pie.
> If that is unclear, maybe it will help if I explain what I'm trying to do.
The pie chart is a chart showing the status of developer issues in an issue
tracking database. (Open, In-Progress, Awaiting Verification, Closed,
Rejected, etc.) Each wedge of the pie has a point label that shows the
number of issues that fall into the category (8 issues opened, 12 issues IP,
etc.) When I click on the label that shows the number, I want to be taken to
a table that shows what the issues in that category are.
> Is this possible with SQL Server Reporting Services? Thanks in advance.|||Thank you very much for your reply. It was very helpful. My report works now.
Justin

Monday, March 26, 2012

Link Server to MySQL Database

Hi

I ma trying to create a linked server to a MySQL database via ODBC. I am running SQL 2005 on Windows 2003 R2 (64-bit). Can any one point me in the right direction .

Any ideas|||MSDASQL (provider shipped with SS2005 which serves as OLEDB-ODBC bridge) is not supported in 64-bit. Check if there is an 64-bit OLEDB provider for MySQL that you can use directly.|||

Thanks for that i will look into it.

|||

Hi James,

Were you able to do that? I am having the trouble doing the same. If you have done, could you please post the procedure.

Thanks,

Neelesh:)

|||Unfortunatly I have not had much time to look at it. I have not managed to find a free / cheap OLE MYSQL driver. Sorry I was not much help|||Can you guys post your email? I can send you a documentation for creating linked servers with MySQL|||

My email address is jamesholmes@.greggs.co.uk

Thanks

|||

Have you tried email me ?

Thanks

Link Server to MySQL Database

Hi

I ma trying to create a linked server to a MySQL database via ODBC. I am running SQL 2005 on Windows 2003 R2 (64-bit). Can any one point me in the right direction .

Any ideas|||MSDASQL (provider shipped with SS2005 which serves as OLEDB-ODBC bridge) is not supported in 64-bit. Check if there is an 64-bit OLEDB provider for MySQL that you can use directly.|||

Thanks for that i will look into it.

|||

Hi James,

Were you able to do that? I am having the trouble doing the same. If you have done, could you please post the procedure.

Thanks,

Neelesh:)

|||Unfortunatly I have not had much time to look at it. I have not managed to find a free / cheap OLE MYSQL driver. Sorry I was not much help|||Can you guys post your email? I can send you a documentation for creating linked servers with MySQL|||

My email address is jamesholmes@.greggs.co.uk

Thanks

|||

Have you tried email me ?

Thanks

Wednesday, March 21, 2012

Line/Point Chart

I am trying to create a simple chart that displays just the data points and
"hide" the line. Scatter chart does not appear to be the right choice for
this. Is there a way to create a line chart and then hide the line so that
only the data points themselves are visible?
JHIn RS 2000 SP1 or later, you can just set the border line width property on
the value to a value of 0.5 pt or lower.
In RS 2005, you can set the border line style to "None".
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"halej51" <halej51@.discussions.microsoft.com> wrote in message
news:5A79CABA-6B4E-4579-9610-B06BF3136F71@.microsoft.com...
>I am trying to create a simple chart that displays just the data points and
> "hide" the line. Scatter chart does not appear to be the right choice for
> this. Is there a way to create a line chart and then hide the line so that
> only the data points themselves are visible?
> JH|||Have you tried setting the line color to the same as the background color?
--
Alphonse Giambrone
Email: a-giam at customdatasolutions dot us
"halej51" <halej51@.discussions.microsoft.com> wrote in message
news:5A79CABA-6B4E-4579-9610-B06BF3136F71@.microsoft.com...
>I am trying to create a simple chart that displays just the data points and
> "hide" the line. Scatter chart does not appear to be the right choice for
> this. Is there a way to create a line chart and then hide the line so that
> only the data points themselves are visible?
> JH

Line Point chart

hi,
How can i change the color property of the line in the line chart.
For bar charts and all i go to series style and change it.
but for line chart, default comes to green - and i would like to change it
to red.
thanksFor line charts, you need to change the series style border line color
(instead of the color property).
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ramani" <Ramani@.discussions.microsoft.com> wrote in message
news:8A2BA0F6-A412-40EC-A316-B9D5F9D44889@.microsoft.com...
> hi,
> How can i change the color property of the line in the line chart.
> For bar charts and all i go to series style and change it.
> but for line chart, default comes to green - and i would like to change it
> to red.
> thanks
>|||Hi All,
I have a line a line chart where there are 2 lines.one of the line seems to
be hidden im not sure y' only one line is displayed at a time...
Can any1 let me know of my problem,
Thanks,
"Robert Bruckner [MSFT]" wrote:
> For line charts, you need to change the series style border line color
> (instead of the color property).
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Ramani" <Ramani@.discussions.microsoft.com> wrote in message
> news:8A2BA0F6-A412-40EC-A316-B9D5F9D44889@.microsoft.com...
> > hi,
> > How can i change the color property of the line in the line chart.
> > For bar charts and all i go to series style and change it.
> > but for line chart, default comes to green - and i would like to change it
> > to red.
> > thanks
> >
>
>

Line Numbers in Table

Sorry but new to RS and need to have each detail line in a table to be
numbered. Can somebody please help me with some code or point me in the
right direction. Not totally sure if it's done via expression or not.Try using the Function Rownumber.
HTH; Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"Nat Johnson" <NatJohnson@.discussions.microsoft.com> schrieb im Newsbeitrag
news:AB24ED87-BBF6-4A3D-A8A5-4770AF92CB54@.microsoft.com...
> Sorry but new to RS and need to have each detail line in a table to be
> numbered. Can somebody please help me with some code or point me in the
> right direction. Not totally sure if it's done via expression or not.

Line Graph One Data Point

Re: SQL Svr 2000

VS.NET 2003, with SQL Reporting Services (RS)

I have a graph that is requested to be a line graph, with data starting in Jan (hence one data point).

The graph lines are not showing, but markers do show.

Can a line graph, in RS, produce lines when there is only one month's data.

If so, pray tell, how?

Y axis is a count of projects by Complexity levels.

X axis are the months, which will range from Jan to Dec, when all the data is in.

I need to show Jan results.

A line chart "connects" data points. If there is only one data point at all, there will be no line.

-- Robert

sql

Monday, March 19, 2012

Line chart, line goes to 0 when data missing

In a line chart, where data is missing, the line goes from the preceding or
next point to zero. This can result in displaying incorrect information to
the user. Example:
Display sales over past two years. We have not measured sales last year
until May. And for this year, we have only measured up to September. For the
missing months, there are no rows in the dataset. I.e., time span in dataset
(number of rows) is May 2003 to September 2004, one row per month.
However, last year line starts February with value of 0. This is false
information. We did not have 0 sales in Feb 2003. We don't know how much
sales we had.
Also, current year sales end at Oct 2004 with value of 0. This is also false
information.
Can the diagram be configured to it just terminate the line "midair" when
input data is missing?
TIA
Tibor Karaszi
SQL Server MVPWe have identified this issue in the chart control recently and provided a
hotfix. Please feel free to contact CSS/PSS and refer them to KB 883675.
http://support.microsoft.com/default.aspx?scid=kb;en-us;883675
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:Ox44SSiqEHA.2340@.TK2MSFTNGP11.phx.gbl...
> In a line chart, where data is missing, the line goes from the preceding
or
> next point to zero. This can result in displaying incorrect information to
> the user. Example:
> Display sales over past two years. We have not measured sales last year
> until May. And for this year, we have only measured up to September. For
the
> missing months, there are no rows in the dataset. I.e., time span in
dataset
> (number of rows) is May 2003 to September 2004, one row per month.
> However, last year line starts February with value of 0. This is false
> information. We did not have 0 sales in Feb 2003. We don't know how much
> sales we had.
> Also, current year sales end at Oct 2004 with value of 0. This is also
false
> information.
> Can the diagram be configured to it just terminate the line "midair" when
> input data is missing?
> TIA
> Tibor Karaszi
> SQL Server MVP
>|||Does this apply to missing rows as well?
The KB refers to rows with NULL for the value. My case is that I have no row
for certain points, and I don't want the prior or next point to make up a
point with a value of 0.
FYI:
I have an expression for the Style of the line, so that current year is
solid, past year is dotted:
=Iif( Fields!year_offset.Value = 0, "Solid", "Dotted")
I also have an expression for Color of the line. Since I have bunch of
diagrams I pick up the color from a text box (so I can change color in one
place):
=ReportItems!gcsSelected.Value
Thanks!
Tibor
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:u$GIP9iqEHA.1988@.TK2MSFTNGP09.phx.gbl...
> We have identified this issue in the chart control recently and provided a
> hotfix. Please feel free to contact CSS/PSS and refer them to KB 883675.
> http://support.microsoft.com/default.aspx?scid=kb;en-us;883675
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
in
> message news:Ox44SSiqEHA.2340@.TK2MSFTNGP11.phx.gbl...
> > In a line chart, where data is missing, the line goes from the preceding
> or
> > next point to zero. This can result in displaying incorrect information
to
> > the user. Example:
> >
> > Display sales over past two years. We have not measured sales last year
> > until May. And for this year, we have only measured up to September. For
> the
> > missing months, there are no rows in the dataset. I.e., time span in
> dataset
> > (number of rows) is May 2003 to September 2004, one row per month.
> >
> > However, last year line starts February with value of 0. This is false
> > information. We did not have 0 sales in Feb 2003. We don't know how much
> > sales we had.
> > Also, current year sales end at Oct 2004 with value of 0. This is also
> false
> > information.
> >
> > Can the diagram be configured to it just terminate the line "midair"
when
> > input data is missing?
> >
> > TIA
> > Tibor Karaszi
> > SQL Server MVP
> >
> >
>|||> Does this apply to missing rows as well?
Just FYI for some future reader. The answer is "yes".
I created a repro at home and on a machine with a fix, the endpoints did not "go to zero".
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:OsL4esrqEHA.3744@.TK2MSFTNGP10.phx.gbl...
> Does this apply to missing rows as well?
> The KB refers to rows with NULL for the value. My case is that I have no row
> for certain points, and I don't want the prior or next point to make up a
> point with a value of 0.
>
>
> FYI:
> I have an expression for the Style of the line, so that current year is
> solid, past year is dotted:
> =Iif( Fields!year_offset.Value = 0, "Solid", "Dotted")
> I also have an expression for Color of the line. Since I have bunch of
> diagrams I pick up the color from a text box (so I can change color in one
> place):
> =ReportItems!gcsSelected.Value
> Thanks!
> Tibor
>
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:u$GIP9iqEHA.1988@.TK2MSFTNGP09.phx.gbl...
>> We have identified this issue in the chart control recently and provided a
>> hotfix. Please feel free to contact CSS/PSS and refer them to KB 883675.
>> http://support.microsoft.com/default.aspx?scid=kb;en-us;883675
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>>
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
> in
>> message news:Ox44SSiqEHA.2340@.TK2MSFTNGP11.phx.gbl...
>> > In a line chart, where data is missing, the line goes from the preceding
>> or
>> > next point to zero. This can result in displaying incorrect information
> to
>> > the user. Example:
>> >
>> > Display sales over past two years. We have not measured sales last year
>> > until May. And for this year, we have only measured up to September. For
>> the
>> > missing months, there are no rows in the dataset. I.e., time span in
>> dataset
>> > (number of rows) is May 2003 to September 2004, one row per month.
>> >
>> > However, last year line starts February with value of 0. This is false
>> > information. We did not have 0 sales in Feb 2003. We don't know how much
>> > sales we had.
>> > Also, current year sales end at Oct 2004 with value of 0. This is also
>> false
>> > information.
>> >
>> > Can the diagram be configured to it just terminate the line "midair"
> when
>> > input data is missing?
>> >
>> > TIA
>> > Tibor Karaszi
>> > SQL Server MVP
>> >
>> >
>>
>

Line Chart X-Axis has too many point

Hi All,
I have a Chart line report that works great except when there are too many
data points. The x-axis labels then get too cramped and become unreadable.
I saw from another post that to fix this, you right mouse click on the chart
object, select properties, select "X Axis" tab, set "Major tick mark" to
"None" and "Minor tick mark" to "None". So I have "Major tick mark" set to
"None" and "Minor tick mark" set to "None" and also set on my "X Axis" tab
is: Checkbox "Show labels" is "Checked" and "Scale Minimum" = 0 (nothing
else is specified). However, this is not solving the problem (i.e. the
x-axis labels are still cramped together and unreadable).
I called Dundas Software and their tech support department said they cannot
provide technical support to me since I am using the Chart control packaged
with SQL Reporting Svsc 2005.
Can anyone offer any advice on how I can solve this?
Thanks in advance.Hello,
Since SQL Server 2005 has not been publicly released yet, we do not support
SQL Server 2005 in the newsgroup. For any SQL Server 2005 and related
issues, you could post here
http://communities.microsoft.com/newsgroups/default.asp?icp=sqlserver2005&sl
cid=us
Thank you for your patience and cooperation.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
=====================================================When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Sorry, typo...I am on SQL Reporting Svcs 2000.
"Anthony LaMark" <anthony@.eXcSoftware.com> wrote in message
news:%23xWn$y%23tFHA.3252@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I have a Chart line report that works great except when there are too many
> data points. The x-axis labels then get too cramped and become
> unreadable. I saw from another post that to fix this, you right mouse
> click on the chart object, select properties, select "X Axis" tab, set
> "Major tick mark" to "None" and "Minor tick mark" to "None". So I have
> "Major tick mark" set to "None" and "Minor tick mark" set to "None" and
> also set on my "X Axis" tab is: Checkbox "Show labels" is "Checked" and
> "Scale Minimum" = 0 (nothing else is specified). However, this is not
> solving the problem (i.e. the x-axis labels are still cramped together and
> unreadable).
> I called Dundas Software and their tech support department said they
> cannot provide technical support to me since I am using the Chart control
> packaged with SQL Reporting Svsc 2005.
> Can anyone offer any advice on how I can solve this?
> Thanks in advance.
>|||Hello,
Please reproduce this issue with the sample AdventureWorks2000 database,
then post here the detailed steps to reproduce the issue. Send the report
to me so I can check the issue on my side. My email address is
v-sguo@.microsoft.com. After checking it I will let you know the results.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
=====================================================When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||It sounds like your are NOT using a timescale/numeric x-axis. You can solve
the issue with too many labels on the x-axis by setting the x-axis MINOR
interval value to e.g. 5 (i.e. one label per 5 categories / data samples).
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Anthony LaMark" <anthony@.eXcSoftware.com> wrote in message
news:eTarYvGuFHA.3500@.TK2MSFTNGP09.phx.gbl...
> Sorry, typo...I am on SQL Reporting Svcs 2000.
> "Anthony LaMark" <anthony@.eXcSoftware.com> wrote in message
> news:%23xWn$y%23tFHA.3252@.TK2MSFTNGP10.phx.gbl...
>> Hi All,
>> I have a Chart line report that works great except when there are too
>> many data points. The x-axis labels then get too cramped and become
>> unreadable. I saw from another post that to fix this, you right mouse
>> click on the chart object, select properties, select "X Axis" tab, set
>> "Major tick mark" to "None" and "Minor tick mark" to "None". So I have
>> "Major tick mark" set to "None" and "Minor tick mark" set to "None" and
>> also set on my "X Axis" tab is: Checkbox "Show labels" is "Checked" and
>> "Scale Minimum" = 0 (nothing else is specified). However, this is not
>> solving the problem (i.e. the x-axis labels are still cramped together
>> and unreadable).
>> I called Dundas Software and their tech support department said they
>> cannot provide technical support to me since I am using the Chart control
>> packaged with SQL Reporting Svsc 2005.
>> Can anyone offer any advice on how I can solve this?
>> Thanks in advance.
>

Line between page columns?

Hi all,

My report's body section is split into 2 columns. I need to be able to add a vertical line to the dividing point of these columns so that it is visually more recognisable. How can I do this?

Thank you,

Stephen.

Any ideas? I am having real trouble with this.

Stephen.

Friday, March 9, 2012

limiting query result based on AS clause

can some point me to a sql statement that would perfrom the equivalent of th
e
following statement?
select Desc, (select count (*) from CART_Items where
fkItemCategoryID=CART_ItemCategories.pkItemCategoryID ) itemcount
from CART_ItemCategories
where itemcount >0
typical ouput
Desc itemcount
Cat 1 0
Cat 2 2
Cat 3 1
Cat 4 0
i would simply like to limit my results to itemcount values greater than zer
o.SELECT
ic.Desc,
COUNT(ci.fkItemCategoryID)
FROM
Cart_Items ci
INNER JOIN
Cart_ItemCategories ic
ON
ci.fkItemCategoryID = ic.pkItemCategoryID
GROUP BY
ic.Desc
HAVING
COUNT(ci.fkItemCategoryID) > 0;
"Fabuloussites" <Fabuloussites@.discussions.microsoft.com> wrote in message
news:FFF7450A-A17A-479B-B169-8DE92212E3CD@.microsoft.com...
> can some point me to a sql statement that would perfrom the equivalent of
> the
> following statement?
> select Desc, (select count (*) from CART_Items where
> fkItemCategoryID=CART_ItemCategories.pkItemCategoryID ) itemcount
> from CART_ItemCategories
> where itemcount >0
>
> typical ouput
> Desc itemcount
> Cat 1 0
> Cat 2 2
> Cat 3 1
> Cat 4 0
> i would simply like to limit my results to itemcount values greater than
> zero.|||thanks a million
"Aaron Bertrand [SQL Server MVP]" wrote:

> SELECT
> ic.Desc,
> COUNT(ci.fkItemCategoryID)
> FROM
> Cart_Items ci
> INNER JOIN
> Cart_ItemCategories ic
> ON
> ci.fkItemCategoryID = ic.pkItemCategoryID
> GROUP BY
> ic.Desc
> HAVING
> COUNT(ci.fkItemCategoryID) > 0;
>
>
> "Fabuloussites" <Fabuloussites@.discussions.microsoft.com> wrote in message
> news:FFF7450A-A17A-479B-B169-8DE92212E3CD@.microsoft.com...
>
>

Wednesday, March 7, 2012

Limited Query Builder in sql2005 sms

Can any body point me in the right direction before i pull all my hair out, (not much left).

Moving from sql 2000 to 2005, yes very pretty, but all i want 2do is quickly query a table, like u could in 2000 by right click the table name and select Query, my experiance of 2005 has been very frustrating, why remove useful features, not impressed.

anyway

Is it possible to invoke, from within the sql2005 sms, the Query Builder that is used in the Report Designer as this builder has 100% more functionality than the cut down version that comes standard in the very expensive sql2005 sms.

Any ideas?

Cheers

First, let me respond to clarify a 'mis-statement':

the very expensive sql2005 sms

SSMS is suprisingly enough, included with SQL Server. It is NOT sold separately, there is not a ''price' for SSMS.

Now, if you wish to use the query builder function, similar to the Access/Excel/SQL 2000 Query Builder, it is still available.

Unfortunately, it doesn't have a dedicated menu entry. Hopefully, that will be corrected in a future release.

To use the query builder functionality, follow these steps (grumble if you want, but these are the steps...):

Right-click on a table, select [Open Table] The table will open in Grid format. If it is a large table, it could take some time, so you may wish to click on the 'Red' stop button in the bottom of the data pane. Then, in the toolbar, on the left, will be icons for the Diagram, Criteria, and SQL panes. Choose the ones you desire. Then, when your query is constructed, click on the [Execute SQL] button (the red exclamation mark).|||

Thank you for your condesending reply, nice to see you didnt actualy answer my question. in fact after a bit of browsing on and off this site this same limitation towards productivity has been brought up many times without being recified, as far back as 2005, your instructions are typical of the vacuum packed training many "experts" seem to excel in. if i opend a table for query like you suggest, a table that could have over 500,000,000 records in it, good use of server resources that, once ive managed to cancel the request, after about 10 clicks i could get a visual query editor of sorts, but i can only open that table once, very useful, we also get a "change type" button thats never active, start typing "insert into <tablename>" into the sql pain and the columns change in the criteria pain like as you would get if the could select "change type". As ive said previously these limitations were highlight by other users as far back a s2005, we still seem to be waiting for a decent interface.

As a paying customer, when i buy software, i receive, if im lucky, a cd to install, this cd installs the software I've purchased, usually, as far as im conserned the software that gets installed is what ive paid for, it dosent tell me this bit is free, or that bit is free, so give the, its free, what do u expect attitude. The problems ive experianced after purchasing this expensive product seems to have been shared by many within this forum, without be rectified. but not to worry it will all be sorted in the next version that us punters will have to pay up for again.

nice touch about the shoes, but when i buy a new pair of shoes, i pay decent money for them, because i can, and i get a pair that are as comfortable as my old ones, they have been Well designed and tested propely and are fit for purpose. glad i dont wear m$ shoes.

thanks again for you help and suggestions, your a credit to your profession! in my opinion.

|||The product can always can be as good as the responses from the field are. Microsoft introduced the http://connect.microsoft.com portal where customer can suggest new features and put up bugs which they encountered. These sites are monitored by the product teams, in fact they are doing periodic rounds to discuss effort for changes and impact on the product for bringing updates / feature in Serverice Releases / Service Packs. Feel free to post a connect suggestion and you will see that it will be picked up and answered soon.

Jens K. Suessmeyer

http://www.sqlserver2005.de

Friday, February 24, 2012

limit the number of digits after decimal point in flaot data type

Hi..

I have a column in the data base with the type Float,

I want to limit the number of digits after decimal point to 2 when I display the value in ASP.NET but I don't know how!?

the number that appear after calculation llike "93.333333"

I use decimal(2,2) as data type but an error accour and this is the message

"- Unable to modify table.
Arithmetic overflow error converting float to data type numeric.
The statement has been terminated."

Can you help me..

thanks

Hi..


Before saving to database you can use String.Format() method to modify your float value.

First you need to convert float into string using

String myStr = Convert.ToString(yourFloatHere);

And then use String.Format("{0:N}", myStr);

and then again convert it into float using COnvert.ToDouble(MyStr);

Cheers n Hope it would help

|||

Hi..

I try what you suggest but the following error produced:

Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?)

Do you konw its solution?!

This is my code:

//------------------

float temp;

String value;

SqlConnection con =newSqlConnection(@."Data Source=localhost ;Initial Catalog=university ;Integrated Security=True");

con.Open();

SqlCommand cmd =newSqlCommand("select SUM(FinalGrid)/COUNT(FinalGrid)from studentSections Where studentSection_UserID='" + Session["ID"].ToString() +"'", con);

SqlDataReader reader = cmd.ExecuteReader();

while (reader.Read())

{

value =Convert.ToString(reader[0]);

}

String.Format("{0:2}", value);temp =Convert.ToDouble(value); //Here is the error

reader.Close();

//------------------------

Is it has any wrong?!

|||

Do not use the decimal(2,2). Just have the way it is now and just modify the SQL statment that you use to retrive the data and include the function

STR(columnname, lenght, number of decimal places)

This function will automatically round the data in this column to number of decimal places u want when the data is returned to ur ASP.NET application.

|||

Hi..

Can you tell me where I should use this function? and what do you mean by "length" ?

|||

Suppose you are using the query "select column1 from table1" to get the data to your applicaiton, where column1 is the one where you want only 2 decimals

u will have to use it as "select str(column1,10,2) as column1 from table1"

this will make sure you have only 2 decimals in the data that is returned, if there are more than 2 , it will round it to 2 decimals.

|||

Thanks so much its work very nice