如何在js中调用C#后台带参函数
展开全部
给你看个一段demo, 希望能帮到你:
<script runat="server">
public static void bind()
{
string sqlParam = "select top 6 a.CourseID as courseid,Name,TeacherName,ordertype,CountPid,paytime,GoodsMoney,Target from KS_CosOrder a inner join KS_course b on a.courseid=b.courseid where TeachWay=1 and Status=1 and a.username ='" + UserManage.GetUserInfo().UserName + "' order by paytime deSC";
using (dk = DataFactory.GetDataTable(sqlParam))
{
if (dk.Rows.Count > 0)
{
dr = dk.Rows[0];
}
}
}
</script>
其中DataFactory.GetDataTable(sqlParam) 就是后台cs 文件中的方法,直接就可以这样用
。
<script runat="server">
public static void bind()
{
string sqlParam = "select top 6 a.CourseID as courseid,Name,TeacherName,ordertype,CountPid,paytime,GoodsMoney,Target from KS_CosOrder a inner join KS_course b on a.courseid=b.courseid where TeachWay=1 and Status=1 and a.username ='" + UserManage.GetUserInfo().UserName + "' order by paytime deSC";
using (dk = DataFactory.GetDataTable(sqlParam))
{
if (dk.Rows.Count > 0)
{
dr = dk.Rows[0];
}
}
}
</script>
其中DataFactory.GetDataTable(sqlParam) 就是后台cs 文件中的方法,直接就可以这样用
。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询