我想创建一个C#方法,它接受一个参数,即存储过程的名称.然后,该方法将直接执行以下系统存储过程,而无需使用用户定义的子例程来包装此调用.
sys.sp_helptext 'proc name'
我收到错误:
Could not find stored procedure ‘sys.sp_help_text
public static string GetStoredProcedure(string objectName,string connectionString) { using (sqlConnection sqlConnection = new sqlConnection()) { sqlConnection.ConnectionString = connectionString; sqlConnection.open(); sqlCommand sqlCommand = new sqlCommand("sys.sp_help_text",sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@objname",objectName); DataSet ds = new DataSet(); sqlDataAdapter sqlDataAdapter = new sqlDataAdapter(); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(ds); return DataTabletoString(ds.Tables[0]);; } }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。