Show / Hide Table of Contents

    IDataStoreBase.GetSqlSelect() Method

    .NET Standard 2.x

    Gets the SQL SELECT statement for the current DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public string GetSqlSelect();
    

    Returns

    System.String

    Returns the current SQL SELECT statement.

    Remarks

    When you want to change the SQL SELECT statement for a DataStore at runtime, you can use GetSQLSelect to save the current SELECT statement before making the change.

    Examples

    The following code example demonstrates how to get the SQL statement for the current DataStore.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreBaseExamples
    {
        public class GetSqlSelectExample
        {
            private readonly SchoolContext _context;
    
            public GetSqlSelectExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    			
    			// Gets the SQL statement for the current DataStore.
                string sql = datastore.GetSqlSelect();
    
                Console.WriteLine("SqlSelect:\n{0}", sql);
    
                /*This code produces the following output:
                 
                SqlSelect:
                SELECT
                [Department].[DepartmentID],
                [Department].[Name],
                [Department].[Budget],
                [Department].[StartDate],
                [Department].[Administrator]
                FROM [Department]
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon