The following is taken from devcurry: this is pretty much what you are looking for.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName],
[ContactTitle], [Address] FROM [Customers]"
onselected="SqlDataSource1_Selected">
</asp:SqlDataSource>
And in the code behind:
Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As SqlDataSourceStatusEventArgs)
If e.AffectedRows < 1 Then
' perform action
End If
End Sub
source
share