我正在使用DbCompre工具。基本上我的要求是通过C#在Web应用程序中生成存储过程脚本。首先是可能的?通过ASP中的C#获取存储过程脚本
在SQL Server中,我们通过右键单击或通过命令sp_helptext <ProcedureName>
轻松生成脚本。
这里是我的代码:
public DataTable generateScripts()
{
SqlCommand cmd = new SqlCommand("sys.sp_helptext dloc_GetTasksRewarehousePutaway", AppCon);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(DS);
adp.SelectCommand = cmd;
return DS.Tables[0];
}
当代码执行我收到此错误:
Could not find stored procedure 'sys.sp_helptext dloc_GetTasksRewarehousePutaway'
但在数据库中此过程中是可用的。
什么连接路径,你在安美设置? – Mainak
连接字符串完美工作,因为我在整个应用程序中使用了相同的连接字符串。 – Anjyr