Argentini.Halide.H3Sql.ExportCSV C# (CSharp) Method

ExportCSV() public static method

Generate CSV data from a SQL Server data request, and write it to a file. Converts quotation marks to """.
public static ExportCSV ( String select, String connectionStringName, System.Boolean includeHeaders, System.Boolean alwaysUseQuotes, String filePath ) : System.Boolean
select String SQL Server command to execute, which retrieves a dataset.
connectionStringName String Connection String name in the Web.config file.
includeHeaders System.Boolean Include column names as a header row in the CSV file.
alwaysUseQuotes System.Boolean Wrap all values in quotation marks. False will omit quotation marks around numeric values.
filePath String Web-style path and filename for the output of the data.
return System.Boolean
        public static Boolean ExportCSV(String select, String connectionStringName, Boolean includeHeaders, Boolean alwaysUseQuotes, String filePath)
        {
            Boolean retVal = false;

            StringBuilder CSV = new StringBuilder();

            CSV = GenerateCSV(select, connectionStringName, includeHeaders, alwaysUseQuotes);

            H3Storage.WriteFile(filePath, CSV.ToString());

            if (H3Storage.FileExists(filePath))
            {
                retVal = true;
            }

            return retVal;
        }

Same methods

H3Sql::ExportCSV ( String select, String connectionStringName, String filePath ) : System.Boolean