locked
Problem in update RRS feed

  • Question

  • User-790334697 posted

    Hello All

    My problem is when i update from sqldatasource by below code

    UPDATE CBLNCTBL SET CBLNC = (SELECT (SELECT (SELECT (CASE WHEN (SELECT CAST(OPNBLNC AS bigint) FROM PRDTTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT CAST(OPNBLNC AS bigint) FROM PRDTTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) + (SELECT (CASE WHEN (SELECT SUM(CNT) AS PCNT FROM PBPRDTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(CNT) AS PCNT FROM PBPRDTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) AS Expr1) - (SELECT (SELECT (CASE WHEN (SELECT SUM(CNT) AS RPCNT FROM RSBPRDTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(CNT) AS RPCNT FROM RSBPRDTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) + (SELECT (CASE WHEN (SELECT SUM(CNT) AS SCNT FROM SBPRDTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(CNT) AS SCNT FROM SBPRDTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) + (SELECT (CASE WHEN (SELECT SUM(QTY) AS WCNT FROM WPRDCTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(QTY) AS WCNT FROM WPRDCTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) AS Expr1) AS cblnc) WHERE ([PRDTN] = @PRDTN);

    <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:HWTRSysCon %>" SelectCommand="SELECT PRDTN,CBLNC FROM CBLNCTBL" InsertCommand="INSERT INTO  CBLNCTBL(PRDTN,PRDTNM,ALTNT,ALTORD)SELECT PRDTN,PRDTNM,ALTNT,ALTORD FROM PRDTTBL WHERE NOT EXISTS (select PRDTN from CBLNCTBL)"UpdateCommand="UPDATE CBLNCTBL SET CBLNC = (SELECT (SELECT (SELECT (CASE WHEN (SELECT CAST(OPNBLNC AS bigint) FROM PRDTTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT CAST(OPNBLNC AS bigint) FROM PRDTTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) + (SELECT (CASE WHEN (SELECT SUM(CNT) AS PCNT FROM PBPRDTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(CNT) AS PCNT FROM PBPRDTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) AS Expr1) - (SELECT (SELECT (CASE WHEN (SELECT SUM(CNT) AS RPCNT FROM RSBPRDTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(CNT) AS RPCNT FROM RSBPRDTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) + (SELECT (CASE WHEN (SELECT SUM(CNT) AS SCNT FROM SBPRDTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(CNT) AS SCNT FROM SBPRDTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) + (SELECT (CASE WHEN (SELECT SUM(QTY) AS WCNT FROM WPRDCTBL WHERE [PRDTN] = @PRDTN) IS NULL THEN '0' ELSE (SELECT SUM(QTY) AS WCNT FROM WPRDCTBL WHERE [PRDTN] = @PRDTN) END) AS Expr1) AS Expr1) AS cblnc) WHERE ([PRDTN] = @PRDTN);"><UpdateParameters><asp:Parameter Name="PRDTN" /></UpdateParameters></asp:SqlDataSource>

    it not updte anything

    and in page load

                SqlDataSource5.Insert();

                SqlDataSource5.Update();

    Saturday, March 26, 2016 4:44 PM

Answers