🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
1 messages
1 total messages Started by siraj Wed, 22 Feb 2006 15:34
TADODataset and autoincrement field
#677
Author: siraj
Date: Wed, 22 Feb 2006 15:34
38 lines
2732 bytes
Hi,
I have a problem inserting autoicrement primary key field with TADODataset. 
I am using MS access 2000.
I am now using C++ builder 2006. Previously I was using c++ builder 5.
I am converting my c++ builder 5 project to C++ builder 2006 and the code 
that was running in C++ builder 5 in not working in C++ builder 2006.
The code is as follows:
-------------------------------------------------------------------------------------------------
  Form1->Calibration = 0;
 Form1->StoringADODataSet->Close();
 Form1->StoringADODataSet->CommandType=cmdText;
 Form1->StoringADODataSet->CommandText="SELECT * FROM  CALIBRATION";
 Form1->StoringADODataSet->Open();


 for (int i=12;i<230+1;i++)
 {
          Form1->Calibration++;
          Form1->StoringADODataSet->Insert();
          Form1->StoringADODataSet->FieldValues["CalibrationID"]= 
Form1->Calibration; /*autoincrement field*/
          Form1->StoringADODataSet->FieldValues["Coef0"]=0 ;
          Form1->StoringADODataSet->FieldValues["Coef1"]=1;
          Form1->StoringADODataSet->FieldValues["Coef2"]=2 ;
          Form1->StoringADODataSet->FieldValues["Coef3"]=3;
          Form1->StoringADODataSet->FieldValues["TimeStamp"] = 
DateTimeToStr(Now());
          Form1->StoringADODataSet->FieldValues["CalibrationName"] = "sms";

          Form1->StoringADODataSet->Post();
          Form1->StoringADODataSet->UpdateBatch(arCurrent);
 }
--------------------------------------------------------------------------------------------------------
In c++ builder 2006, I get the error " Field 'CalibrationID' cannot be 
modified ". where as in C++ builder 2005, i have no such error.
Any ideas???
Regards,
Siraj
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads