C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Get Number of rows affected by SqlDataSource / ObjectDataSource select Query


Posted Date: 09 May 2008    Resource Type: Code Snippets    Category: ADO.NET

Posted By: Kamal       Member Level: Gold
Rating:     Points: 10



Get Number of rows affected by SqlDataSource / ObjectDataSource select Query
For SqlDataSource
To find out number of rows affected or returned by SqlDataSource select Query for that create event handler for 'Selected' event of the SqlDataSource control.Then,use 'AffectedRows' property of the SqlDataSource 'e' parameter to get of the number of records affected by the SqlDataSource.

Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)Handles SqlDataSource1.Selected
lblRecordCount.Text = "No of Records : " & e.AffectedRows
End Sub

For ObjectDataSource
In ObjectDataSource data returned in dataset or datareader so for that use below
code.

Protected Sub ObjectDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs)Handles ObjectDataSource1.Selected
dsCount = New DataSet()
dsCount = e.ReturnValue
lblRecordCount.Text = "No Of Records : " & dsCount.Tables(0).Rows.Count.ToString()
End Sub




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: List of Databases
Previous Resource: DB Null validation in the data Reader.
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween masks

Contact Us    Privacy Policy    Terms Of Use