Can someone please help?!? I’m having problems trying to insert a record into the vendor table. I have connected and I can scroll through all the records no problem. The problem is when I try to insert. Here is the procedure; (This source code is written in Delphi ver 6) procedure TfrmMain.btnInsertClick(Sender: TObject); var inserti : integer; str: string; var outvstr : olevariant; begin str := txtField1.text; outvstr := str; // insert into navision hRec1 := cfrontnf.AllocRec(xtable1); cfrontnf.BWT; cfrontnf.InitRec(xtable1,hRec1); cfrontnf.AssignField (xtable1,hrec1,1,outvstr); if (cfrontnf.InsertRec(xtable1,hRec1)) then begin cfrontnf.AWT; cfrontnf.FreeRec(hRec1); end else begin cfrontnf.EWT; cfrontnf.FreeRec(hRec1); end; end;
[ code] … [ /code] added
Check C/FRONT examples for VB (Excel file->Macros). Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia
quote:
Originally posted by CMDunbar:
if (cfrontnf.InsertRec(xtable1,hRec1)) then begin cfrontnf.AWT; cfrontnf.FreeRec(hRec1); end else begin cfrontnf.EWT; cfrontnf.FreeRec(hRec1); end; end;
There are error. AWT meens abort write transaction, EWT end write transaction. So, this code meens if record inserted abort write transaction.
Thanks Dalius. I’m still having problem inserting values into this table - at the moment I can insert a blank record. I think I’ll have another look at the examples - as Alexei suggested. However, last time I looked, I didn’t think they were much help. Thanks again to you both.
What field type are you trying to insert and in what version of Navision? I posted last week regarding DateFormula types and Ive reported the issue to Navision. Craig Bradney
Craig, Hi thanks for your response. The database is version 2.00D, but C-Side & CFRONT is Attain version 3.01. I copied the code from the samples but get the following error; “You cannot make any changes in the database from this trigger.” The line of code causing the error is; “cfrontnf.InsertRec(xtable1, NewRec);” Any ideas?
This is meen that you inserting rec without BWT(); not started write transaction. Place BWT() before inserting. Do you meen 200D version of C/AL code ? Or Fdb file version ?
CAL is version 3.01 (Attain), along with the OCX control (from Attain CD). Database however, is still version 2.00D. Thanks Dalius.
Hi I have almost the same problem. I am using Navision 2.00 fdb file with the cfront object the ships with it. When I try to assign a value into a field I get an error “type mismatch”. I am using VB.net and here is the code. Dim MyVar As String MyVar = TextBox2.Text Dim TableReference As Integer Dim RecordReference As Integer Dim objCFront As New CFRONTLib.CFRONT objCFront.ConnectServer("10.10.10.155", "tcp") objCFront.OpenDatabase("c:\DB001.fdb", 100000, True) objCFront.Login("super", "password") objCFront.OpenCompany("ABC Company") objCFront.OpenTable(TableReference, 8) RecordReference = objCFront.AllocRec(TableReference) If objCFront.FindRec(TableReference, RecordReference, "-") Then objCFront.AssignField(TableReference, RecordReference, 2, MyVar) objCFront.ModifyRec(TableReference, RecordReference) End If
When I try to use an other version of the ocx eg. 2.60 or 3.60 it would not even connect to the server. [ code] …[ /code] added.
Try this: Dim MyVar As VARIANT
What is the type of MyVar? Did I solve this problem in the past by using a variant[?]
Hi, can someone please help me?! I will use the C/Front for the Navision Server, but I have a big problem. In the Manual of C/Front is describbed how to connect to a Navision Server but Visual Studio.Net only give me two Errors. Here my Code #include “CF.h” #define SERVERNAME “Server1” #define NETTYPE “tcp” void main() { DBL_ConnectServer(SERVERNAME, NETTYPE); /* … */ DBL_DisconnectServer(); } What is wrong with this SourceCode??? Thanx Bjoern.