Show / Hide Table of Contents

    DbResultSet.GetPbDataType(string columnName) Method

    .NET Standard 2.x

    Gets the data type in PowerBuilder for the specified column in the result set.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

     public PbDataType GetPbDataType(string columnName)
    

    Parameters

    columnName System.String

    The name of the column.

    Returns

    PowerScript.Bridge.PbDataType

    Returns the data type in .NET.

    Examples

    The following code example demonstrates how to use the GetPbDataType method to get the PowerBuilder data type of the Grade column in the DbResultSet object.

    using System;
    using SnapObjects.Data;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.DbResultSetExamples
    {
        public class GetPbDataTypeExample
        {
            private readonly SchoolContext _context;
    
            public GetPbDataTypeExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example2()
            {
                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();
    
                if (resultSet.SqlCode == 0)
                {
    
                    // Gets the PowerBuilder data type of the Grade column
                    var pbType = resultSet.GetPbDataType("Grade");
    
                    Console.WriteLine($"pbType = {pbType}");
                }
    
                resultSet.Close();
    
                /*This code produces the following output:
                
                pbType = Decimal
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon