I tried to execute a stored procedure in my console application but what I get is a print of the sentence I want to call.
My stored procedure that I have created:
create proc Checked
@Links nvarchar(MAX)
as
SELECT CASE
WHEN EXISTS (
SELECT ID
FROM News
WHERE LinkNews = @Links
)
THEN CAST(1 AS BIT)
ELSE CAST(0 AS BIT) END
And the method that I used to call the stored procedure inside the Console Application:
using (DbContextClass db = new DbContextClass())
{
SqlParameter p = new SqlParameter("@Links", "http://www.newsline-ye.com/news7527.html");
IEnumerable<New> n = db.Database.SqlQuery<New>("exec Checked @Links", p);
Console.WriteLine(n);
}
Console.ReadKey();
My Problem It gives me this output "exec Checked @Links" sentence
Can anyone help me to solve my problem?