从jTable搜索数据使用存储过程和asp.net MVC [英] Search data from jTable use stored procedure and asp.net MVC

查看:66
本文介绍了从jTable搜索数据使用存储过程和asp.net MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从数据库表中显示了数据。后来我按名称或年份进行了数据挖掘,一切正常。但现在我想搜索JTable中显示的数据。我尝试使用将从数据库中检索数据的存储过程。

我得到错误6没有重载方法'Procedura_searchdata'需要0个参数



感谢您的回答



程序



I made a display of data from a database table. Later I made a data mining by name or year, and everything works. But now I would like to search for data that are displayed in the JTable. I try to use stored procerdure that will retrieve data from the database.
I get Error 6 No overload for method 'Procedura_searchdata' takes 0 arguments

Thanks for answer

Procedure

Alter PROCEDURE searchdata
    
    @name varchar(200) = null,
    
    @year datatime = null
    
    AS
    
    BEGIN
    
          SET NOCOUNT ON;
    
          SET @name =  NULLIF(@name, '')
    
          SET @year = NULLIF(@year , '')
    
        SELECT Name FROM Person
        WHERE
    
        (@name = '' or Name = @name)
    
        AND
    
        (@year = '' or Year = @year)
    
    END
GO





JSON







JSON


     public JsonResult Check()
            {
    
                    using (var z = new database())
                        {
                            DataList = z.ShowDataLista().ToList<ProcedureShowDataLista_Result>();
    SearchData = ctx.Procedure_searchdata().ToList<Procedure_searchdata_Result>();
        
                    } 
    
                    return Json(new { Result = "OK", Records = DataList,SearchData});
    
            

       
        }







.cshtml






.cshtml

 <div>
        @using (Html.BeginForm("Index", "Project", FormMethod.Get))
        {
            Search
            @Html.RadioButton("findBy", "Name", true) <text>Name </text>
           @Html.RadioButton("findBy", "Year") <text>Year </text>
           <br />


         @Html.TextBox("search")

                   <input type="submit" value="Search" />

            }
        </div>
     <script>
     $('#Check').jtable({
            messages: polishMessages,
            paging: true,
            actions: {
                listAction: '@Url.Action("Check")'

            },
            fields: {
                Name: {
                    title: 'Name',
                    width: '40px'
                },
                Year: {
                    title: 'Year',
                    width: '40px'
                }

            }
        });

        $('#Check').jtable('load');

    });

</script>

推荐答案

(< span class =code-string>' #Check')。jtable({
messages:polishMessages,
paging: true
操作:{
listAction:' @ Url.Action(Check)'

},
字段:{
名称:{
title:' 名称'
宽度:' 40px'
},
年份:{
title:' 年'
宽度:' 40px'
}

}
});
('#Check').jtable({ messages: polishMessages, paging: true, actions: { listAction: '@Url.Action("Check")' }, fields: { Name: { title: 'Name', width: '40px' }, Year: { title: 'Year', width: '40px' } } });


' < span class =code-string> #Check')。jtable(' load');

});

< / script >
('#Check').jtable('load'); }); </script>


这篇关于从jTable搜索数据使用存储过程和asp.net MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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