Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
//const char *sqlStatement ="insert into usertable values('one','two')";
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement,NULL) == SQLITE_OK) { NSLog(@"inside"); // Loop through the results and add them to the feeds array while(sqlite3_step(compiledStatement) == SQLITE_ROW) { } sqlite3_finalize(compiledStatement);
}
if i run this code, the values does not get inserted into the database. however if i uncomment the second line and comment the first line it works fine. the variable "query" is of type NSMutableString and it is a local variable declared in the header file. sqlStatement is member variable for the method. i tried several things like retain and release and nothing worked. not able to resolve this for the past 2 days. and its kindof getting frustrated.
//const char *sqlStatement ="insert into usertable values('one','two')";
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement,NULL) == SQLITE_OK) { NSLog(@"inside"); // Loop through the results and add them to the feeds array while(sqlite3_step(compiledStatement) == SQLITE_ROW) { } sqlite3_finalize(compiledStatement);
}
if i run this code, the values does not get inserted into the database. however if i uncomment the second line and comment the first line it works fine. the variable "query" is of type NSMutableString and it is a local variable declared in the header file. sqlStatement is member variable for the method. i tried several things like retain and release and nothing worked. not able to resolve this for the past 2 days. and its kindof getting frustrated.
i also tested with your code and its working too. i should have posted this 2 days ago. it would have saved lot of time for me , anyways thank you soo much for your response.
Replies
As first line.
Right now you are casting 'id' to 'const char*'.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomei just used the below code and it worked fine.
sqlStatement=[query cStringUsingEncoding:NSASCIIStringEncoding];
i also tested with your code and its working too. i should have posted this 2 days ago. it would have saved lot of time for me , anyways thank you soo much for your response.
Have a nice day.
Thank You.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome