/// <summary> /// Loads the results of a SQL query into a DataTable object. /// Uses the default connection string "Halide". /// </summary> /// <example> /// <code> /// using Argentini.Halide; /// ... /// 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); }
/// <summary> /// Loads the results of a SQL query into a DataTable object. /// </summary> /// <example> /// <code> /// using Argentini.Halide; /// ... /// 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); }