Show / Hide Table of Contents

    DataStoreDataExtensions.ExportString(this IDataStoreBase dataStore, int startRow, int endRow, int startColumn, int endColumn, bool colheading = true) Method

    .NET Standard 2.x

    Exports the rows (from the specified starting position to the ending position) and the columns (from the specified starting position to the ending position) from the primary buffer of the DataStore to a string. The column name is exported by default.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public static int ImportString(this IDataStoreBase dataStore, int startRow, int endRow, int startColumn, int endColumn, bool colheading = true);
    

    Parameters

    startRow System.Int32

    The zero-based index number for the starting row.

    endRow System.Int32

    The zero-based index number for the ending row.

    If it is negative, it indicates the rest of rows.

    startColumn System.Int32

    The zero-based index number for the starting column.

    endColumn System.Int32

    The zero-based index number for the ending column.

    If it is negative, it indicates the rest of columns.

    colheading System.Boolean

    True (default): The column name is exported.

    False: The column name is not exported.

    Returns

    System.Int32

    Returns the string if it succeeds.

    Remarks

    Values are separated by tabs. A newline character ("\r\n" for non-Unix platforms, and "\n" for Unix platforms) is placed at the end of each line.

    Examples

    The following code example demonstrates how to use the ExportString method to export the department records from the specified rows and columns of the DataStore primary buffer to a string using the startRow, endRow, startColumn, and endColumn parameters.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.DataStoreDataExtensionsExamples
    {
        public class ExportStringExample
        {
            private readonly SchoolContext _context;
    
            public ExportStringExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example3()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                // Generates data in the primary/delete/filter buffers for this example.
                datastore.Retrieve();
                datastore.DeleteRow(0);
                datastore.SetFilter("departmentid < 5");
                datastore.Filter();
    
                // Exports data from the first and second rows and
                // from the second and third columns with column headings.
                string text = datastore.ExportString(0, 1, 1, 2);
    
                Console.WriteLine("datastore.ExportString(0, 1, 1, 2):");
                Console.WriteLine(text);
    
                // Exports data from the first and second rows and
                // from the second and third columns without column headings.
                text = datastore.ExportString(0, 1, 1, 2, false);
    
                Console.WriteLine("datastore.ExportString(0, 1, 1, 2, false):");
                Console.WriteLine(text);
    
                /*This code produces the following output:
    
                datastore.ExportString(0, 1, 1, 2):
                "Name"  "Budget"
                "English"       120000.0000
                "Economics"     200000.0000
    
                datastore.ExportString(0, 1, 1, 2, false):
                "English"       120000.0000
                "Economics"     200000.0000
               */
            }
        }
    }
    

    Example Refer To

    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon