在SqlCommand中调用函数
public void CreateMySqlCommand() { SqlCommand myCommand = new SqlCommand(); myCommand.CommandText = "SELECT * FROM Categories ORDER BY CategoryID"; myCommand.CommandTimeout = 15; myCommand.CommandType = CommandType.Text; }
我可以在myCommand.CommandText中使用Sql Server函数吗?为什么?
如果您的意思是, SQL Server用户定义的函数 。 然后, 是的 ; 你可以正常使用它:
myCommand.CommandText = "SELECT fn_Yourfunctionname(@parameternames)"; myCommand.CommandType = CommandType.Text; myCommand.Parameters.Add(new SqlParameter("@parameternames", ...
它工作的原因是因为这是在SQL Server中直接调用函数的方式。
上述就是C#学习教程:在SqlCommand中调用函数分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/1029945.html