If you are working with VS 2010 (any Edition) and cannot open your 2010 solution on VS 2008 then just follow these 3 Steps:



For .sln:



1. Open the solution file in your favorite text editor (ex: notepad++).



2. Find the Following:Microsoft Visual Studio Solution File, Format Version 11.00.# Visual Studio 2010.



Replace with: Microsoft Visual Studio Solution File, Format Version 10.00. (I)# Visual Studio 2008. (II, optinal)



For .csproj/vbproj:



1. Open project file in your favorite text editor (ex: notepad++).



2. Find the Following:.



Replace with: .



(III) Thats it..Now you can open your solution file on VS2008.Reverse of this will enable VS2008 solution to open in VS2010.

Category : | Read More......

Whenever you want to execute a sql statement that shouldn't return a value or a record set the ExecuteNonQuery should be used. So if you want to run an update, delete, or insert statement, you should use the ExecuteNonQuery. ExecuteNonQuery returns the number of rows affected by the statement.


This sounds very nice, but whenever you use the SQL Server 2005 IDE or Visual Studio to create a Stored Procedure it adds a small line that ruins everything. That line is: SET NOCOUNT ON; This line turns on the NOCOUNT feature of SQL Server, which "Stops the message indicating the number of rows affected by a Transact-SQL statement from being returned as part of the results" and therefore it makes the SP always to return -1 when called from the application (in my case a web app).



In conclusion, remove that line from your SP and you will now get a value indicating the number of rows affected by the statement.