Here is my code in Microsoft Visual Studio ASP.NET MVC4 using C#
int numRows = new SqlCommand("execute getRows", con);
Error message:
Cannot implicitly convert type 'System.Data.SqlClient.SqlCommand' to 'int'
Am I missing a step? Like do I have to do an ExecuteReader() type of thing?
I can't find a good resource on using SQL commands in ASP.NET MVC 4.
I know NOT to use string concatenation b/c of SQL injection, so I'm trying to use SQL Server stored procedure.
Here is the procedure:
CREATE PROCEDURE getRows
AS
BEGIN
select COUNT(*)
from myTable
where Status = 1
END
Note: I have tried casting with (int) and with Int.Parse. I assume it has something to do with reading it? Or with making getRows procedure have an output?