0

私はすでに最初のデータを挿入しています。私の問題は、次のデータを最初のデータからのループカウントを挿入し、最後のデータで終了するときです

-(void)GetAllSplitDataHandler:(id)value { 
 int j; 
 // NSError error; 
 if([value isKindOfClass:[NSError class]])
 { 
     NSLog(@"%@", value); return; 
  } 
 // Handle faults 
 if([value isKindOfClass:[SoapFault class]]) 
 { 
  NSLog(@"%@", value); 
  return; 
 } 
 NSMutableArray result = (NSMutableArray*)value; 
 NSLog(@"GetAllAtheleteHandler returned the value: %@", result ); 
 if([[NSString stringWithFormat:@"%@",result] isEqualToString:@"1"]){ 

 NSLog(@"Result Count :: %d",[result count]); 
     for (int i =0; i<[result count]; i++) {

NSMutableDictionary *dic=[[NSMutableDictionary alloc]init];


    [dic setValue:[[result objectAtIndex:0] valueForKey:@"entity1"] forKey:@"entity1"];
    [dic setValue:[[result objectAtIndex:0] valueForKey:@"entity2"] forKey:@"entity2"];

    DAL *objDAL=[[DAL alloc]initDatabase:@"Abc.sqlite"];
    j = [objDAL insertRecord1:dic inTable:@"Abc"];


    if (j == 0) {
        NSLog(@"Inserted Successfully");

    }
    else if(j == -1)
    {
        NSLog(@"Insertion Failed");
       // NSAssert1(0, @"Insertion Failure '%@'.", [error localizedDescription]);
    }
}

}
4

2 に答える 2

0

最後に挿入した id (in NSUserDefaults) データを保存できます。次に Web サービスを呼び出すときは、以前に保存した id の隣の id からデータを挿入するだけです。

于 2012-12-20T07:01:34.477 に答える
0

データベースの一意のキー制約として、データ値の 1 つを使用できます。そのキーが複製される場合、データベースに行は挿入されません。

于 2012-12-20T09:16:10.010 に答える