Hi is it possible to run a stored procedure from a razor file?
What I've got so far is:
@using System; @using System.Data; @using System.Configuration; @using System.Data.SqlClient; @{ var db = Database.Open("zDevConnection"); var param1 = "informationhere"; var param2 = "informationhere"; // or var param2 = 15247 (no quotes necessary if param is an integer datatype) var procRows = db.Query("Exec dbo.procName @RealParameterName1=@0, @RealParameterName2=@1", param1, param2); } <table> @foreach( var procRow in procRows ) { <tr> <td>@procRow.ColumnName1</td> <td>@procRow.ColumnName2</td> <td>@procRow.ColumnName3</td> //etc </tr>
} </table>
But I'm getting an error of The name 'Database' does not exist in the current context
I'm pretty sure that I'm missing an assembly reference but I don't know which one?
Running STP from Razor
Hi is it possible to run a stored procedure from a razor file?
What I've got so far is:
But I'm getting an error of The name 'Database' does not exist in the current context
I'm pretty sure that I'm missing an assembly reference but I don't know which one?
Can I even do this?
Thanks in advance
is working on a reply...