Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7498137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:21:20+00:00 2026-05-29T19:21:20+00:00

I seem to have run into difficulties with a simple database insert statement. I’m

  • 0

I seem to have run into difficulties with a simple database insert statement.
I’m inserting something into the database then (for debugging reasons) checking the number of rows. For the first example this doesn’t work. For the second “rawQuery” it does. Am I overlooking something simple? I’ve used this method loads of times before with no problems!

This doesn’t work:

contentValues = new ContentValues();
contentValues.put("classId", cursor.getString(0));
contentValues.put("to_do", toDo);
contentValues.put("date", date);
out("SIZE OF TODO+"+fetchCount());//returns 105
db.insert("toDo", null, contentValues);
out("NEW SIZE OF TODO+"+fetchCount());//still returns 105!

this does:

out("SIZE OF TODO+"+fetchCount()); //returns 105
db.execSQL("insert into toDo values(null, "+cursor.getString(0)+", '"+toDo+"', '"+date+"')");
out("NEW SIZE OF TODO+"+fetchCount());//returns 106

What’s going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:21:22+00:00Added an answer on May 29, 2026 at 7:21 pm

    I’m such an idiot, @Rob’s suggestion of looking at my create tables made me realise, I was referring to the wrong column name. It never occurred to me that an update statement like this could fail silently! Thanks @Rob

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just learning codeigniter, and I seem to have run into something that is
I'm building a database and have run into a problem that I can't seem
I seem to have run into a bit of trouble this morning with removeClass
I seem to have run into a case where git doesn't notice inline changes
I seem to have run into a strange bug or more likely some setting
I just recently started toying with output buffering and seem to have run into
I seem to have run into an issue in what I am trying to
I seem to have run into a limitation in SUP regarding its ability to
I have been recently learning some OOP PHP and seem to have run into
I seem to have run into a peculiar problem. Here is the code #read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.