ekonbenefits / dotnetdbf

This is a basic file parser written in C# for reading and writing xBase DBF files, particularly Clipper.
GNU Lesser General Public License v2.1
56 stars 29 forks source link

Unable to read memo fields created by dotnetdbf writer using other dbf readers #13

Open agaddampalli opened 7 years ago

agaddampalli commented 7 years ago

I have certain files which has memo fields and dotnetdbf writer created the dbt files for those.

        using (Stream fos = File.Open(@"E:\temp\estima.dbf", FileMode.OpenOrCreate, FileAccess.ReadWrite))
        {
            var writer = new DBFWriter();
            writer.DataMemoLoc = @"E:\temp\estima.dbt";
            MemoValue emailVal = new MemoValue("a@gmail.com");
            var id = new DBFField("Id", NativeDbType.Numeric, 15, 0);
            var name = new DBFField("name", NativeDbType.Char, 30, 0);
            var address = new DBFField("address", NativeDbType.Date);
            var email = new DBFField("email", NativeDbType.Memo);

            var dbFields = new List<DBFField> { id, name, address, email };
            writer.Fields = dbFields.ToArray();
            List<object> values = new List<object> { 1, "Jhon", DateTime.Now, emailVal };
            writer.AddRecord(values.ToArray());

            writer.Write(fos);
        }

I tried to read these files using java xbase DBF reader to read the generated dbf file, it was unable to read the memo fields and throwing a null pointer exception.

I tried with other reader which had the same issue of reading the memo fields from dbt file.

Could you please help me getting through this issue

jbtule commented 7 years ago

I don't know? What libraries specifically? We use this to interoperate with clipper and harbour, and they work just fine.

agaddampalli commented 7 years ago

we work with http://xbasej.sourceforge.net/api/org/xBaseJ/DBF.html to read the DBF files