Show / Hide Table of Contents

    DbResultSet.ColumnCount Property

    .NET Standard 2.x

    Gets the number of the property columns in the result set.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

      public abstract short ColumnCount { get; }
    

    Property Value

    System.Short

    Returns the number of the property columns 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 columns in the result set.

    using System;
    using SnapObjects.Data;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.DbResultSetExamples
    {
        public class ColumnCountExample
        {
            private readonly SchoolContext _context;
    
            public ColumnCountExample(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 columns stored in the result set
                Console.WriteLine($"ColumnCount = {resultSet.ColumnCount}");
    
                resultSet.Close();
    
                /*This code produces the following output:
                
                ColumnCount = 4
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon