Example #1
0
        /// <summary>
        /// Loads the results of a SQL query into a DataTable object.
        /// Uses the default connection string "Halide".
        /// </summary>
        /// <example>
        /// <code>
        /// using Mezzocode.Halide3;
        /// ...
        /// DataTable dt = h3Sql.ReadTable("SELECT TOP 5 FROM tablename;");
        /// </code>
        /// </example>
        /// <param name="Statement">SQL statement to execute.</param>
        /// <returns>DataTable object.</returns>
        public static DataTable ReadTable(string Statement)
        {
            DataTable dt = new DataTable();

            using (h3Reader reader = new h3Reader(Statement))
            {
                dt = reader.ReadTable();
            }

            return (dt);
        }
Example #2
0
        /// <summary>
        /// Loads the results of a SQL query into a DataTable object.
        /// </summary>
        /// <example>
        /// <code>
        /// using Mezzocode.Halide3;
        /// ...
        /// DataTable dt = h3Sql.ReadTable("SELECT TOP 5 FROM tablename;", "SqlServer01");
        /// </code>
        /// </example>
        /// <param name="Statement">SQL statement to execute.</param>
        /// <param name="ConnectionStringName">Name of a connection string in the Web.config file.</param>
        /// <returns>DataTable object.</returns>
        public static DataTable ReadTable(string Statement, string ConnectionStringName)
        {
            DataTable dt = new DataTable();

            using (h3Reader reader = new h3Reader(Statement, ConnectionStringName))
            {
                dt = reader.ReadTable();
            }

            return (dt);
        }