Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3439530
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:19:17+00:00 2026-05-18T08:19:17+00:00

This is my programs complete code, the only problem is i want to fix

  • 0

This is my programs complete code, the only problem is i want to fix the amount of decimal places that show up in my gridview. The problem is if i do this on the asp side the location of the column gets thrown off and the column is duplicated. I figured if i just remade the table on the asp side it would work only problem is if i remove the sql for that particular column the asp side column cannot get data.

 Imports System.Data.Sql
    Imports System.Data.SqlClient
    Imports System.Data
    Partial Class _Default
        Inherits System.Web.UI.Page
        Public saocmd As New SqlCommand()
        Public saoda As New SqlDataAdapter(saocmd)

        Dim saods As New DataSet

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            saocmd.Connection = conn
            conn.Open()

            Dim ds As New DataSet

            saocmd.CommandText = "SELECT B603SalesAsOFMASTER.SDESCR, B603SalesAsOFMASTER.DYYYY, B603SalesAsOFMASTER.AsOFSales, B603SalesAsOFMASTER.ASOFPAX, B603SalesAsOFMASTER.YESales, B603SalesAsOFMASTER.YEPAX, B603SalesAsOFMASTER.PCTofSales, B601SalesAsOF.Sales AS [Current Sales], B601SalesAsOF.PAX AS [Current PAX] FROM B603SalesAsOFMASTER INNER JOIN B601SalesAsOF ON B603SalesAsOFMASTER.SDESCR = B601SalesAsOF.SDESCR WHERE (B603SalesAsOFMASTER.DYYYY = '2008') AND (B601SalesAsOF.DYYYY = '2010')"
            saoda.Fill(saods, "salesasoftable")

            Dim pctofpax As New DataColumn
            pctofpax = New DataColumn("PCTPAX1", GetType(Decimal))
            pctofpax.Expression = "[ASOFPAX] / [YEPAX]"
            saods.Tables("salesasoftable").Columns.Add(pctofpax)

            Dim avgppax As New DataColumn
            avgppax = New DataColumn("AVG PAX", GetType(Double))
            avgppax.Expression = "[Current Sales] / [Current PAX]"
            saods.Tables("salesasoftable").Columns.Add(avgppax)

            Dim projectedye As New DataColumn
            projectedye = New DataColumn("Projected YE Sales", GetType(Double))
            projectedye.Expression = "[Current Sales] / PCTofSales"
            saods.Tables("salesasoftable").Columns.Add(projectedye)

            Dim projectedyep As New DataColumn
            projectedyep = New DataColumn("Projected YE PAX", GetType(Double))
            projectedyep.Expression = "[Current PAX] / PCTPAX1"
            saods.Tables("salesasoftable").Columns.Add(projectedyep)



            GridView1.DataSource = saods

            GridView1.DataBind()

            saoda.FillSchema(saods, SchemaType.Mapped)

            conn.Close()
        End Sub
    End Class

ASP Side



     <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>

            <span lang="en-us">Sales As Of Analysis</span><br />
           <asp:GridView ID="GridView1" runat="server" BackColor="White" 
                  BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                  GridLines="Vertical">
        <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#DCDCDC" />
        <Columns>
             <asp:Boundfield DataField="SDESCR" 
                             HeaderText="Regions">
             </asp:Boundfield>

             <asp:Boundfield DataField="DYYYY" 
                             HeaderText="DYYYY">
             </asp:Boundfield>


            <asp:Boundfield DataField="asofsales" 
                             HeaderText="As Of Sales" 
                             DataFormatString="{0:c}">
            </asp:Boundfield>
        </Columns>
    </asp:GridView>

        </div>
        </form>
    </body>
    </html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:19:18+00:00Added an answer on May 18, 2026 at 8:19 am

    the answer was to turn off autogenerate columns!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm want to make code that reads assembly instructions (x86 only) and recreates them
very simple problem, but i want to see how experts look at it. This
I've made a simple program (closely resting on this example) that visualises my problem.
EDIT: Sometimes it happens that our problem is kind of not in code but
I know this might seem silly, but why does the following code only work
I am complete newbie for programming and this is my first real program I
int main() { int i=3; (++i)++; printf(%d,i); } This programs works with g++ compiler
I came across this term - Quine (also called self-reproducing programs). Just wanted to
I've two programs I'm using in this way: $ c_program | python_program.py c_program prints
This is not a pure programming question, however it impacts the performance of programs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.