如何传递来自DrillDown的存储过程中的id

时间:2017-05-26 05:09:22

标签: c# sql sql-server sql-server-2008 c#-4.0

我正在使用图表并使条形图向下钻取并显示值,我想知道,如何在存储过程中传递来自向下钻取的ID 注意:请查看" elseif"中的代码。 这是我的代码

C#Part:

    else if (Request.QueryString["ddLevel"] == "2")
    {
        Chart.Title = "ABSENTEE REPORT";
       // de.SqlStatement = "Select Empname,TotalLeave,LeaveType From Charting32 Where Deptname = '" + Request.QueryString["id"] + "'";
        de.StoredProcedure = "AbsenteeReport1 Where Deptname = '" + Request.QueryString["id"] + "'";
        de.ConnectionString = conString;
        de.ParameterCollection.Clear();
        de.AddParameter("@Startdate", txtstart.Text, FieldType.Date);
        de.AddParameter("@Enddate", txtend.Text, FieldType.Date);
        de.DataFields = "xAxis=Empname,yAxis=TotalLeave,ToolTip=LeaveType";
        SC = de.GetSeries();
        Chart.DefaultElement.ToolTip = "<block>Type: <block hAlign='left'>%yvalue<row>";
        txtstart.Visible = false;
        txtend.Visible = false;
        Button3.Visible = false;
        Button2.Visible = false;
        Chart.Height = 550;

        foreach (Series s in SC)
        {
            foreach (Element el in s.Elements)
            {
                el.ToolTip = "<block>LeaveType:<block>".Replace(":", System.Environment.NewLine) + el.ToolTip.Replace(",", System.Environment.NewLine);     
            } 
        }
        Chart.SeriesCollection.Add(SC);
    } 

}

    ALTER procedure [dbo].[AbsenteeReport1](@Startdate DateTime,@Enddate Datetime)
as
Begin
With CTE as (
    SELECT   EmployeeDetails.Empname,
             DepartmentDetails.Deptname ,
             LeaveApplication.LeaveType,
             Sum(LeaveApplication.NoOfDays) As TotalLeave 
    FROM DepartmentDetails 
    Inner JOIN EmployeeDetails on EmployeeDetails.DeptID = DepartmentDetails.DeptID
    INNER JOIN LeaveApplication On EmployeeDetails.EmpID = LeaveApplication.EmpID
    WHERE     LeaveApplication.LeaveFromDate >=@Startdate 
          AND LeaveApplication.LeaveFromDate <=@Enddate 
          AND  EmployeeDetails.Status=0 
          AND  LeaveApplication.leavetype not in ('Forgot Access Card','Permission','Work from Home',
                                          'Holiday Allowance/Weekend Allowance','On Duty','Night Shift Allowance') 
          AND LeaveApplication.LeaveStatus<>'Rejected'
    GROUP BY     LeaveApplication.EmpID ,
             DepartmentDetails.Deptname,
             EmployeeDetails.Empname,
             LeaveApplication.LeaveType
         )
select EmpName, Deptname, stuff ((
    select ',' + LeaveType+'-'+ cast(TotalLeave as varchar(5)) from CTE where EmpName = t.EmpName and Deptname = t.Deptname for xml path('')
    ),1,1,'') as LeaveType,
    Sum(TotalLeave) as TotalLeave
from CTE t
group by EmpName, Deptname

End

我的Sp:

var autobahn = require('autobahn');
var wsuri = "wss://api.poloniex.com";
var connection = new autobahn.Connection({
  url: wsuri,
  realm: "realm1"
});

connection.onopen = function (session) {
        function marketEvent (args,kwargs) {
                console.log(args);
        }
        session.subscribe('BTC_XMR', marketEvent);

        function tickerEvent (args,kwargs) {
                console.log(args);
        }
        function trollboxEvent (args,kwargs) {
                console.log(args);
        }

        session.subscribe('ticker', tickerEvent);
        session.subscribe('trollbox', trollboxEvent);
}

connection.onclose = function () {
  console.log("Websocket connection closed");
}

connection.open();

0 个答案:

没有答案