コード例 #1
0
ファイル: Program.cs プロジェクト: stbear/NDbfReaderEx
        private static void OpenNDX()
        {
            Console.WriteLine("Isn't realized fully yet!");

            string dbfName = "test_ix.dbf";
            string ndxName = "test_ix.ndx";

            using (DbfTable test = DbfTable.Open(dbfName, Encoding.GetEncoding(437)))
            {
                Console.WriteLine();
                Console.WriteLine("Open index: " + ndxName);

                IIndexFile ndx = test.JoinIndexFile(ndxName);

                Console.WriteLine("Index key : " + ndx.KeyExpression);
                Console.WriteLine();

                var row = ndx.Top();

                Console.WriteLine("----------------------------- 'AAA' field --------------------------------------");
                Console.WriteLine("Top()   : '" + row.GetString("AAA") + "'");

                row = ndx.Bottom();

                Console.WriteLine();
                Console.WriteLine("Bottom(): '" + row.GetString("AAA") + "'");

                Console.WriteLine("All rows:");
                row = ndx.Top();                                            // dBase/Clipper style read

                int rowCount = 0;

                while (!ndx.eof)
                {
                    rowCount++;

                    Console.WriteLine(rowCount.ToString("00000") + ": '" + row.GetString("AAA") + "'");
                    row = ndx.Next();
                }

                Console.WriteLine("---eof---");
            }
        }