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 8948553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:01:19+00:00 2026-06-15T13:01:19+00:00

I have an html string I would like to store in my SQLite db

  • 0

I have an html string I would like to store in my SQLite db “as is”. The special characters in the html string prevent my INSERT statement from storing it:

INSERT INTO myTable VALUES ('" + htmlString + "')

On iOS I used parameterized queries to accomplish this and it worked fine. How can I accomplish this on Android? I’ve Google parameterized queries for Android but the results were varied and unclear.

  • 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-06-15T13:01:21+00:00Added an answer on June 15, 2026 at 1:01 pm

    in Android you have parameterized queries too … are few way to achive this:

    ContentValues vals = new ContentValues();
    vals.putString("ColumnName", htmlString);
    db.insert("myTable", null, vals);
    

    or

    final SQLiteStatement insert = db.compileStatement("INSERT INTO myTable VALUES (?)");
    insert.bindString(1, htmlString);
    //edit: hehe forgot about most important thing 
    insert.executeInsert(); 
    

    or

    db.rawQuery("INSERT INTO myTable VALUES (?)", new String[] {htmlString});
    

    EDIT: (inserting multiple rows)

    if you wana insert more than 1 row then do it in transaction (it should be quicker)
    and prefer 2nd solution:

    db.beginTransaction();
    try {
      final SQLiteStatement insert = db.compileStatement("INSERT INTO myTable VALUES (?)");
      for(...){
        insert.clearBindings();
        insert.bindString(1, htmlString[N]);
        //edit: hehe forgot about most important thing 
        insert.executeInsert();
      }
      db.setTransactionSuccessful();
    } finally {
      db.endTransaction();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like a=6&id=99 (i might store it in html as 'a=6&id=99'
I have $_SERVER['HTTP_REFERER'] — pretend it is http://example.com/i/like/turtles.html . What would I need to
I have some html content stored in a database field. I would like trusted
Objective: I would like to take a JSON String and pass it into JavaScript
I'm putting some dates into an array, and would like to have a second
I have HTML code edited by FCKEditor stored in a database and would like
I have a HTML string and want to replace all links to just a
I have HTML pages as String in Java and I need to extract the
I have a big HTML-string containing multiple child-nodes. Is it possible to construct a
I have 145064642 chars long HTML String which I am trying to print. When

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.