Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 SQL Results

Author  Topic 

lucasite
Starting Member

4 Posts

Posted - 2005-06-13 : 08:55:09
Hi,
a simple question. If I use Query Analyser under MS SQL, to execute a non query statement, i get the following message:

Query: DELETE FROM Customers

Result: (10 records affected)

Here's the code in VB.net

Dim c as new sqlcommand("DELETE FROM Customers",cnn)
c.executenonquery

How do I find out how many results were affected?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-13 : 09:27:16
Create Stored Procedure having that query with output parameter.
Set the last line of that sp as
Select @Output=@@RowCount
You need to use Command object in .NET to retrieve output parameter value from Stored Procedure

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -