I have various stored procedures. I need a stored procedure to execute the stored procedure, and then I return only the number of rows (the number of rows returned by the called procedure), and I need to get it in C # code.
What is the best way to do this?
Situation: I have various stored procedures that are called from C # code. Now for another purpose, I need to know the number of rows returned by the procedure (I don't want the rows returned, I just need the number of rows). I cannot change the most stored procedure, since many of my C # codes use them, so everything can break if I change the procedures. Therefore, I am blocking a procedure that will take input and execute the procedure (dynamically) and return the number of rows, but not the result or rows.
I can take a stored procedure string and execute it as
EXEC ('SearchWallpaper @Keyword = ''' + @Key + '''')
I have an Id as a column in every possible returned row. I could store identifiers and count this, but I don't know what if this is a better idea.
My database is quite large. I could use executeenonquery () in C #, but it returns -1 when I execute any stored procedure with it. What a better way. Thanks.
source share