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
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
<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>