28. Juli 2009 15:39
CurrentTable = CFrontDotNet.Instance.OpenTable(18); //set current table
CurrentRecord = CFrontDotNet.Instance.AllocRecord(CurrentTable); //allocate record in current table
int FiledNoID = CFrontDotNet.Instance.FieldNo(CurrentTable, "search name");
//fetch No. of field "search name" - hack for problem while using field "id"
int FieldNoName = CFrontDotNet.Instance.FieldNo(CurrentTable, "name"); //fetch No. of field "name"
bool recordFound = false;
bool transactionSuccessful = false;
try
{
CFrontDotNet.Instance.SetFilter(CurrentTable, FiledNoID, customer.Id.ToString());
recordFound = CFrontDotNet.Instance.FindFirstRecord(CurrentTable, CurrentRecord);
}
catch (CFrontException cfrontEx)
{
recordFound = false;
}
CFrontDotNet.Instance.BeginWriteTransaction();
if (recordFound == true)
{
Console.WriteLine("recordfound true für: " + customer.Id);
CFrontDotNet.Instance.InitRecord(CurrentTable, CurrentRecord);
CFrontDotNet.Instance.StringToField(CurrentTable, CurrentRecord, FieldNoName, "peter");
transactionSuccessful = CFrontDotNet.Instance.InsertRecord(CurrentTable, CurrentRecord);
if (transactionSuccessful == true) Console.WriteLine("success");
}
else
{
Console.WriteLine("recordfound false für: " + customer.Id);
}
if (transactionSuccessful == false)
{
CFrontDotNet.Instance.AbortWriteTransaction();
}
else
{
CFrontDotNet.Instance.EndWriteTransaction();
}
CFrontDotNet.Instance.FreeRecord(CurrentRecord);
CFrontDotNet.Instance.CloseTable(CurrentTable);
CFrontDotNet.Instance.CloseCompany();
CFrontDotNet.Instance.CloseDatabase();
CFrontDotNet.Instance.DisconnectServer();
CFrontDotNet.Instance.Dispose();
28. Juli 2009 22:36
28. Juli 2009 22:49
CFrontDotNet.Instance.EndWriteTransaction();
28. Juli 2009 23:13
29. Juli 2009 09:47
29. Juli 2009 10:03
29. Juli 2009 10:32
int[] key = {0,1};
key[0] = FieldNoID;
key[1] = 0;
CFrontDotNet.Instance.SetCurrentKey(CurrentTable, key);
CFrontDotNet.Instance.SetFilter(CurrentTable, FieldNoID, customer.Id.ToString());
recordFound = CFrontDotNet.Instance.FindFirstRecord(CurrentTable, CurrentRecord);
if (recordFound == true )
{
CFrontDotNet.Instance.BeginWriteTransaction();
CFrontDotNet.Instance.StringToField(CurrentTable, CurrentRecord, FieldNoName, customer.Company.ToString());
transactionSuccessful = CFrontDotNet.Instance.ModifyRecord(CurrentTable, CurrentRecord);
CFrontDotNet.Instance.EndWriteTransaction();
}
...
29. Juli 2009 11:12
29. Juli 2009 11:25
29. Juli 2009 12:06
29. Juli 2009 14:45
CFrontDotNet.Instance.EndWriteTransaction();