CFRONT proxy component for .NET usage v1.2
This ActiveX component helps to use CFRONT OCX within Microsoft Visual Studio .NET (removed all possible 'Variant' usages).
Public Sub AssignField_AsText( _
ByVal hTable As Long, ByVal hRec As Long, _
ByVal FieldName As String, ByVal FieldValue As String)
Dim lValue As Variant
CF.AssignField hTable, hRec, CF.FieldNo(hTable, FieldName), lValue
End Sub
How and when is the FieldValue stored into the lvalue-field before being passed as last parameted to AssignField?
hmmm... i am stupid fool! sorry...
I forgot insert one small line of code because i am not using this "Assign" procedures.
Working code must be:
Public Sub AssignField_AsText( _
ByVal hTable As Long, ByVal hRec As Long, _
ByVal FieldName As String, ByVal FieldValue As String)
Dim lValue As Variant
lValue = FieldValue
CF.AssignField hTable, hRec, CF.FieldNo(hTable, FieldName), lValue
End Sub
I'm having a problem in attempting to insert a record into a Navision .FDB database table using Visual Studio.NET and C#. When I try to insert a record using the CFRONT.dll AssignField() function, I get a "'type mismatch' error from mscorlib.dll".
Some people recommend using long instead of int, but CFRONTClass.AssignField only takes int as inputs. When I try it I get the following error message: "The best overloaded method match for 'CFRONTLib.CFRONTClass.AssignField(int, int, int, ref object)' has some invalid arguments"
Others have recommended CFRONT proxy component for .NET usage v1.2 which I have also tried. Using Interop.netCFRONT2_Prj supposedly allows for 'AssignField_AsText', ..Boolean, ..Date, ..Decimal,..Integer, and ..Time.
This will not even allow me to connect to a server or a database.
When I try I get the error message: "Object variable or With block variable not set". I'm setting the object variable the same way that I set the object variable for CFRONTClass using Interop.CFRONTLib
I've noticed many other similar un-answered posts. I'm hoping someone has the expertise and can reply with meaningful specifics.
Comments
I forgot insert one small line of code because i am not using this "Assign" procedures.
Working code must be:
I'm getting the following message... any ideas?
Error Message:
You do not have permission to run the C/Front System
Thanks,
Tim
Regards,
Hans de Graaf
Object variable or With block variable not set
I am using this to code in C#. I am trying to update Navision database from a c# application running on the .net framework.
My c# codes are:
cf1.InitializeCFRONT();
cf1.ConnectServerAndOpenDatabase("NDBCN", "testdb", "tcp", "C:\\DP Tech\\Projects\\Developement\\Testing DB.fdb", 10000, true, false, "sa", "sa");
cf1.OpenCompany("Testing");
tab18 = cf1.OpenTableByID(18);
rec18 = cf1.AllocRec(tab18);
temp1 = cf1.FindRec(tab18, rec18, "+");
cf1.SetFilter(tab18, "No.", "= A-10000");
cf1.AllowRecordNotFound();
cf1.SetStopOnAllExceptions(false);
if (cf1.FindRec(tab18, rec18, "-").ToString() == "True")
{
//Modify Customer Data
MessageBox.Show("Found");
}
else
{
//Add Customer Data
MessageBox.Show("Not Found");
cf1.InitRec(tab18, rec18);
cf1.AssignField_AsText(tab18, rec18, "No.", "A-10000");
cf1.AssignField_AsText(tab18, rec18, "Name", "Testing");
cf1.InsertRec(tab18, rec18);
}
And the error I got was something about cannot make changes in the database using this trigger.
Has anyone done this before? And what seems to be the problem?
Thanks
Lawrence
If I'm doing this function:
string fieldvalue = cf.GetFieldDataByName(hTable,hRecord,columnname).ToString();
I'm getting the error {"Object reference not set to an instance of an object." }.
This is only on Date fields.
Regards,
Hans
I am also trying to use CFRONT in C#.net
Can any one tell me what data structure is to be used for hTable and hRec in C# for Corrosponding DBL_HTABLE and DBL_HREC in C/FRONT library.
Thank you very much
Kumar
After some time the reference dissapered/did not work and i can no longer add it to my project.
Any help?
Some people recommend using long instead of int, but CFRONTClass.AssignField only takes int as inputs. When I try it I get the following error message: "The best overloaded method match for 'CFRONTLib.CFRONTClass.AssignField(int, int, int, ref object)' has some invalid arguments"
Others have recommended CFRONT proxy component for .NET usage v1.2 which I have also tried. Using Interop.netCFRONT2_Prj supposedly allows for 'AssignField_AsText', ..Boolean, ..Date, ..Decimal,..Integer, and ..Time.
This will not even allow me to connect to a server or a database.
When I try I get the error message: "Object variable or With block variable not set". I'm setting the object variable the same way that I set the object variable for CFRONTClass using Interop.CFRONTLib
I've noticed many other similar un-answered posts. I'm hoping someone has the expertise and can reply with meaningful specifics.
i am trying to get this working in c# to start. i included the reference at TopicStart now i am trying to use it.
How do i declare cf1 (used above) ?