ocx and calcfields

i’m trying to get data out of a database in c# with the cfront ocx (navision 3.70) if i use the database file (chronus), table language, the last field column(windows language name) is empty. this column is a flowfield. but how do i use the calcfields function? ----------- int k = 0; fNumber = 0; do { dRow = dTable.NewRow(); fNumber = cf.NextField(hTable,fNumber); do { if (fNumber == 7) { object tempffield = new object(); tempffield = fNumber; cf.CalcFields(hTable,hRecord, ref tempffield); } dRow[k] = cf.FieldToStr(hTable, hRecord, fNumber); fNumber = cf.NextField(hTable,fNumber); k++; } while (fNumber != 0); dTable.Rows.Add(dRow); k = 0; fNumber = 0; }while (cf.NextRec(hTable,hRecord, 1) != 0); ---- but this code gives me a type dont match… suspect the object var is a pain in the ass, are there other ways to do this? PS: i did the flowfield detection hardcoded (fNumber == 7), cause if i check what each fieldtype was returned that it was 0 just like the field Name :S code = 5 name = 0 windows language = 4 windows language name = 0

hi, if you just want to get data from this table or a few more, then it should be ok if you hardcode the determination of flowfields. But if you have to get data from a bunch of tables, that can rise over the time, then I suggest you create a “classgenerator”. what should this generator do:

  • connect to Navision
  • loop over all tables
  • create a table_x.h and table_x.cpp file for each table
    the created .h and .cpp files should include all encapsulated cfront-functions that you need, and also the type of each field. best regards feri