krishna03

Query place

Apr 25th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #import <UIKit/UIKit.h>
  2.  
  3. @interface Dataoperation : UIViewController {
  4.  
  5. }
  6. +(NSMutableArray *) getData : (NSString *) actionType : (NSMutableDictionary *) data;
  7. -(NSString *)setDBINPUTFormate:(NSString *) tmpstr ;
  8. @end
  9.  
  10.  
  11.  
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. }
  15. +(NSMutableArray *) getData : (NSString *) actionType : (NSMutableDictionary *) data
  16. {
  17. NSString *sql;
  18. NSMutableArray *db_result=[[NSMutableArray alloc] init];
  19. if([actionType isEqualToString:@"Customer"] )
  20. {
  21. //NSLog(@"hii");
  22. sql=[NSString stringWithFormat:@"Select * from CustomerTable"];
  23. //NSLog(@"%@",sql);
  24. db_result=[DBOperation selectData:sql];
  25. //NSLog(@"%@",[db_result description]);
  26. }
  27. else if ([actionType isEqualToString:@"Customer2"]) {
  28. NSLog(@"SaveOrderInfo %@",[data description]);
  29. NSMutableDictionary *tmp_dict = [[NSMutableDictionary alloc] init];
  30. sql=[NSString stringWithFormat:@"Update SalesHeaderLookup set No_of_products='%@',Description='%@',Amount='%@' where rowid='%@'",
  31. [data valueForKey:@"No_of_products"],
  32. [data valueForKey:@"Description"],
  33. [data valueForKey:@"Amount"],
  34. [data valueForKey:@"rowid"]
  35. ];
  36. BOOL flag;
  37. flag=[DBOperation executeSQL:sql];
  38. if (flag) {
  39. [tmp_dict setObject:@"1" forKey:@"success"];
  40. [db_result addObject:tmp_dict];
  41. [tmp_dict release];
  42. }
  43. else {
  44. [tmp_dict setObject:@"0" forKey:@"Error"];
  45. [db_result addObject:tmp_dict];
  46. [tmp_dict release];
  47. }
  48. }
  49. return db_result;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment