Show / Hide Table of Contents

    ISqlParameter.DataType Property

    .NET Standard 2.x

    Gets the data type of the value used in the SQL parameter.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

       Type DataType { get; }
    

    Property Value

    System.Type

    The data type of the value used in the SQL parameter.

    Examples

    The following code example gets the data type of the SQL query parameter.

    using SnapObjects.Data;
    using System;
    
    namespace Appeon.ApiDoc.ISqlParameterExamples
    {
        public class DataTypeExample
        {
            private readonly SchoolContext _context;
            public DataTypeExample(SchoolContext context)
            {
                _context = context;
            }
    
            public void Example()
            {
                ISqlParameter param = SqlBuilder.Parameter(typeof(int), "id");
                var type = param.DataType;
    
                Console.WriteLine("Data Type = {0}", type);
    
                /*This code produces the following output:
    
                Data Type = System.Int32 
               */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon