Options

C/Front Problems in Visual Basic .NET with FieldNoArray and

wdaurerwdaurer Member Posts: 2
Hi,
I'm using CFront in my Visual Basic .net Application.
I'm accessing Navision on a Microsoft SQL 2000 Server
Dataaccess to normal Datafields work with no problem.

but I'm having Problems with the Calcfields. I tried almost every notation for the FieldNoArray and CalcFields Functions. I always get the same Exception:
===========================================================
System.Runtime.InteropServices.COMException (0x80020005): Typkonflikt.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at CFRONTLib.CFRONTClass.FieldNoArray(Int32 hTable, Object& FieldNameArray)
at testCFRONT.Form1.Form1_Load(Object sender, EventArgs e) in D:\ProgrammierungVB\testCFRONT\testCFRONT\Form1.vb:line 78
===========================================================
what can be wrong?
please help

best Regards
Wolfgang Daurer


here is the Sample Code:
      Dim cf As New CFRONTClass
      cf.CFrontDllName = "cfrontsql"
      cf.StopOnAllExceptions = False
 
      cf.ConnectServerAndOpenDatabase("NDBCS", "testserver", "Named Pipes", "testdb", 0, False, False, "sa", "")
      cf.OpenCompany("TestCompany")
 
      Dim tableref As Integer
      cf.OpenTable(tableref, cf.TableNo("Project"))
      Dim hrec As Integer = cf.AllocRec(tableref)
 
      If cf.FindRec(tableref, hrec, "-") Then
        Do
          '*** Project Number
          Dim val As Object = cf.GetFieldData(tableref, hrec, 1)
          Trace.Write(val.ToString + "  ")

          '*** Project Name
          val = cf.GetFieldData(tableref, hrec, 2)
          Trace.Write(val.ToString + "  ")
 
          '*** Customer Name from  Calcfield
          Dim FieldNameArray() As Object = {"Name"}
          Dim array As Object = FieldNameArray
 
    
          '*** the Following Line has the Error:
          Dim SumFieldNoList As Object = cf.FieldNoArray(tableref, array)        
          cf.CalcFields(tableref, hrec, SumFieldNoList)
 
          val = cf.GetFieldData(tableref, hrec, 58)
          Trace.WriteLine("[" + val.ToString + "]")
 
        Loop While cf.NextRec(tableref, hrec, 1) > 0
 
      End If
 
      cf.FreeRec(hrec)
      cf.CloseTable(tableref)
 
      cf.CloseCompany()
      cf.CloseDatabase()
      cf.DisconnectServer()
[/b]
Sign In or Register to comment.