Operation gives incorrect result RRS feed

  • Question

  • User-523931540 posted

    Hello there
    I'm new to the site and I need your help on a topic. Thanks in advance for your help.

    I do not know english, I use to google translate, I apologize if there is a translation error.

    Operation gives incorrect result, what is the truth?

    Could you help me.

    I want to do

    entering (g) - leaving (c) = remaining

    Could you give me a code sample. Please

    my table (sql express)

    asp.net  (remainingPage.aspx.cs)

     if (!this.IsPostBack)
                    SqlDataSource SqlDataSource1 = new SqlDataSource();
                    SqlDataSource1.ID = "SqlDataSource1";
                    SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connect"].ConnectionString;
                    SqlDataSource1.SelectCommand = "select s1.marka,s1.renkkodu,s1.renkadi, " +
                        "SUM(case when s1.yontem = 'g' then s1.kilo else 0 end) - SUM(case when s1.yontem = 'c' then s1.kilo else 0 end) as kilo" +
                        " from byh_boya_kalan_tbl s1" +
                        " group by s1.marka,s1.renkkodu,s1.renkadi order by s1.renkadi";
                    GridView1.DataSource = SqlDataSource1;

    Thursday, February 22, 2018 3:03 PM


  • User-1838255255 posted

    Hi Omur Tokman,

    According to your description and code, i hope you could post your table data(image format), expected result and exception result for us to test, this could better help you solve the problem.

    Best Regards,

    Eric Du 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 23, 2018 10:18 AM