DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    20

    Trouble trying to display integer values

    Hi I am developing an asp.net web application using c# and having trouble trying to display integer values, that I have taken from the database, correctly on my webform textboxes. The values are consistently displayed with four 0’s after the decimal point and I am just wondering if anyone knows how to prevent this from happening. Thanks in advance.
    Tadhg88

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    What code are you using to read and display the values?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Nov 2004
    Posts
    20

    Type mistake

    sorry amateur error they are actually stored in the sql server database table as "money" and the code im using to display them is

    sqlDataAdapter1.Fill(archivedConcertDataSet1);

    DataTable archivedConcerts = archivedConcertDataSet1.Tables["ArchivedConcert"];

    foreach(DataRow myRow in archivedConcerts.Rows)
    {
    if(SelectConcert.SelectedItem.ToString() == myRow[0].ToString())
    {
    //*** fill textboxes with the concert data
    ViewNumOfPerformances.Text = myRow[1].ToString();
    ViewFeesDue.Text = myRow[2].ToString();
    ViewPercentageOfTicketSales.Text = myRow[3].ToString();
    ViewTotalTicketSales.Text = myRow[4].ToString();
    ViewProfitOrLoss.Text = myRow[5].ToString();
    }
    }

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try this:
    ViewFeesDue.Text = myRow[2].Value.ToString("c");
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links