0

コードは次のとおりです。

- (IBAction)AddExpenseButtonPressed:(id)sender {
    sqlite3 *database;

    NSString *sqlStatement = @"";

    if(sqlite3_open([dataBasePath UTF8String], &database) == SQLITE_OK)
    {
        sqlStatement = [NSString stringWithFormat:@"insert into Expenses (Vendor) values ('%@');",VendorName.text];

//        sqlStatement = [NSString stringWithFormat:@"insert into Expenses ( Date,Vendor,Comment,Rate) values ('%@','%@','%@');",DateText.text,VendorName.text,CommentText.text,RateText.text];

        NSLog(@"%@",sqlStatement);
        if (sqlite3_exec(database, [sqlStatement cStringUsingEncoding:NSUTF8StringEncoding], NULL, NULL, NULL) == SQLITE_OK)
        {
            NSLog(@"record inserted successfully!!");
        }

        sqlite3_close(database);
    }
     NSLog(@"Error is--------%d",sqlite3_errcode(database));

    [self.navigationController popViewControllerAnimated:YES];

}
4

0 に答える 0