public DataTable GetTable()
        {
            using (FileStream fs = new FileStream(this._file, FileMode.Open, FileAccess.Read))
            {
                // Create a datatable to store all the data we retrieve.
                DataTable dtRet = DbfTable.LoadSchema(this);
                dtRet.TableName = this.TableName;

                // Now we read the actual data into the table.
                // First, we skip the header.
                fs.Read(new byte[_hdr.DataOffset], 0, _hdr.DataOffset);

                // Then, we start reading each row into the DataTable
                for (int t = 0; t < _hdr.RecordCount; t++)
                {
                    DataRow dr = dtRet.NewRow();
                    try
                    { dr.ItemArray = this.GetRowData(fs); }
                    catch (Exception ex)
                    {
                        dr.RowError += ((dr.RowError.Length > 0) ? "  " : "") + ex.Message;
                    }
                    // Add the row to the table.
                    dtRet.Rows.Add(dr);
                }

                // Close the data stream
                fs.Close();

                // Return the DataTable
                return(dtRet);
            }
        }
        public DataRow GetRow(int row)
        {
            try
            {
                using (DataTable dtSchema = DbfTable.LoadSchema(this))
                    using (FileStream fs = new FileStream(this._file, FileMode.Open, FileAccess.Read))
                        using (BinaryReader sr = new BinaryReader(fs))
                        {
                            // First we move the pointer to the start of the selected row.
                            this.MoveStreamToRow(row, fs);

                            // Now we're ready to read the data, so prepare
                            //   the DataRow object to return.
                            DataRow retVal = dtSchema.NewRow();

                            // Now we actually read the data.
                            retVal.ItemArray = this.GetRowData(fs);

                            sr.Close();
                            fs.Close();

                            // And return the value.
                            return(retVal);
                        }
            }
            catch
            { throw; }
        }
 public static DataTable LoadSchema(DbfTable dbf)
 {
     return(DbfTable.LoadSchema(dbf.Header));
 }