DbResultSet.RowCount Property
.NET Standard 2.x
Gets the number of rows in the result set.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public abstract int RowCount { get; }
Property Value
System.Int32
Returns the number of rows in the result set.
Examples
The following code example executes a stored procedure and returns the result set which is stored in the DbResultSet
object and then shows the number of rows in the result set.
using System;
using SnapObjects.Data;
using PowerScript.Bridge;
namespace Appeon.ApiDoc.DbResultSetExamples
{
public class RowCountExample
{
private readonly SchoolContext _context;
public RowCountExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example()
{
int studentID = 2;
// Executes a stored procedure which gets the data of StudentGrade table according to StudentID
_context.SqlExecutor.ExecuteProcedure("GetStudentGrades",
out DbResultSet resultSet, ParamValue.New<int>("StudentID", studentID));
resultSet.Next();
// Shows the number of rows stored in the result set
Console.WriteLine($"RowCount = {resultSet.RowCount}");
resultSet.Close();
/*This code produces the following output:
RowCount = 2
*/
}
}
}
Applies to
.NET Standard
2.x