自定义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();
        }
    }

 

posted @ 2013-02-22 17:22  二师弟tl  阅读(259)  评论(0编辑  收藏  举报