sql自定义函数及C#中调用 1、在C#中调用sql自定义函数 1.1 标量值函数 sql语句调用 select dbo.GetClassIDWithName(1) string strSql = string.Format("select dbo.GetClassIDWithName('{0}')",dtTime); DataTable dt = DB_Contrast.DB.OleDbHelper.GetDataTable(strSql); 1.2 表值函数 sql语句调用 select * from GetAnalysis('2015-1-15',1) string strSql = string.Format("select * from dbo.GetAnalysis('{0}',{1}) where 部门='{2}' ",dtTime, classid,"开发"); DataSet ds = DB_Contrast.DB.OleDbHelper.GetDataSet(strSql); 来源:https://www.cnblogs.com/xiaochun126/p/4226296.html