如何将ADO.NET数据传递给angularjs [英] How to pass ADO.NET datatable to angularjs

查看:89
本文介绍了如何将ADO.NET数据传递给angularjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只有当datatable包含data时,我才需要将数据表值作为json传递给angular js。所以我可以在视图中提醒datatable的值。



我尝试过:



I need to pass datatable value as json to angular js only if datatable contains data.So that I can alert the value of datatable in view.

What I have tried:

public DataTable GetChqStatus(decimal chqno)
{
    string sql = "select chqNo,status from tblchqNo where chqNo=@chqno and status='cancelled'";
    SqlParameter[] param = new SqlParameter[]
    {
        new SqlParameter("@chqno", chqno)
    };
    return DBO.GetTable(sql, param, CommandType.Text);
}













public ActionResult getchqStatus(decimal chqno)
       {
           DataTable dt = objemp.WithdrawalBs.GetChqStatus(chqno);
           if (dt.Rows.Count>0)
           {
           return Json(dt, JsonRequestBehavior.AllowGet);
           }


       }







$scope.ChqStatus = function(chqno)
   {
       crudServiceUser.GetChqStatus(chqno).then(function (result) {
           $scope.Cheque = result;

       })

   }

推荐答案

scope.ChqStatus = function(chqno)
{
crudServiceUser.GetChqStatus(chqno).then(function(result){
scope.ChqStatus = function(chqno) { crudServiceUser.GetChqStatus(chqno).then(function (result) {


scope.Cheque = result;

})

}
scope.Cheque = result; }) }


这篇关于如何将ADO.NET数据传递给angularjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆