Thread: Take values from databasefield,calculate them and bring them back

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    46

    Take values from databasefield,calculate them and bring them back

    Hi i made an application in BCB6 and connected with SQL Server 2000.

    insert
    Code:
      int i,records;
      records=ADOTable1->RecordCount;
    
      //Array for save values from Access
      int *getvalues=new int[records];
    
      //Take values from Access
      for(i=0;i<records;i++)
      {
      getvalues[i]=ADOTable1->Fields->Fields[1]->AsInteger;
      ADOTable1->Next();
      }
      ADOTable1->First();
      for(i=0;i<records;i++)
      {
    
      ADOTable1->Append();
      ADOTable1->FieldValues["Pow"]=getvalues[i]*getvalues[i];
      ADOTable1->Post();
      }
    So i made the above code. I want to take the values of table of specifiec field "FileValues" calculate them and post them to new Field "Pow" but it doesnt work my code. Any ideas??
    Last edited by Leite33; 11-06-2006 at 02:40 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed