I'm trying to execute the results of a stored procedure that takes parameters into a temporary table.
// Create #temptable
// ..
using (DbCommand command = connection.CreateCommand())
{
command.CommandText = "INSERT #temptable EXEC [MystoredProcThatHasParams]";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(someObject)
command.ExecuteNonQuery();
}
Output:
Could not find stored procedure ''.
If I remove command.CommandType = CommandType.StoredProcedure, I get:
Procedure or function 'MystoredProcThatHasParams' expects parameter '@p1' which was not supplied
Is it possible to save the output of a stored procedure that takes parameters from a query in C#?
string.Formator something in there?