C#使用ajax连接SQL Server时候出现了错误

C#使用ajax连接SQL Server数据库的时候有错误

HTML页面

    <h2>查询学生</h2>
    <input type="text" id="checkInput" placeholder="请输入要查询学生的姓名关键词:" style="width:200px;height:50px" />
    <button type="button" id="checkBtn" style="width:80px;height:55px">查询</button>
    <h2>显示学生</h2>
    <div id="showDiv"></div>

ajax

$(document).ready(function () {
    $("#checkBtn").click(function () {
        var checkInput = $("#checkInput").val();
        var checkInputJson = "{'checkInput':'checkInput'}"

        $.ajax({
            type: "Post",
            url: "Server.aspx/CheckStudInfo",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            data: checkInputJson,
            success: function (data) {
                $("#showDiv").html(data.d);
            },
            error: function (err) {
                alert(err)
            }
        })
    });
})

服务器页面端出现问题

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Web.Script.Services;
using System.Data;
using System.Data.SqlClient;

namespace WebApplication1
{
    public partial class Server : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        [WebMethod]
        public static List<StudInfo> CheckStudInfo(string checkInput)
        {
            SqlConnection sqlConnection = new SqlConnection();
            string checkSQL = "select * from dbo.StudInfo where StudName like '%" + checkInput + "%'";
            List<StudInfo> list = sqlConnection.Database.SqlQuery<StudInfo>(checkSQL).ToList();
            return list;
        }
    }
}

提示错误

StudInfo,这个类没有找到,可能的原因是
类型写错了
缺少using,导致包含StudInfo的命名空间没有导入
忘记定义StudInfo类型了。

StudInfo 数据类型没有定义或者是没有引用对应的命名空间。