自定义mssql的CLR函数
[Microsoft.SqlServer.Server.SqlFunction(DataAccess = Microsoft.SqlServer.Server.DataAccessKind.Read)] public static int GetRadioScore(string StandardAnswer, string StudentAnswer, int ProblemScore, int MRQPartialScore) { using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection("context connection=true")) { conn.Open(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select count(id) from answersheetdetail", conn); return (int)cmd.ExecuteScalar(); } }