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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:25:31+00:00 2026-06-15T10:25:31+00:00

Having a hard time saving data from a native text field to sqlite database

  • 0

Having a hard time saving data from a native text field to sqlite database in corona.

here are some relevant code:

    function printrecord()
        for row in db:nrows("SELECT * FROM test") do
           t = display.newText(row.pname .. " " .. row.age .. " " .. row.desc, 20, 30 * row.id, null, 16)
           t:setTextColor(255,255,255)
        end
    end

    newData = native.newTextField ( 20, _H - 90, 280, 30 )
    newData.inputType = "text"

    saveData = function ( event )
        textString = newData.text
        db:exec( [[ INSERT INTO test VALUES (NULL, textString, 30, "unknown")]] )
        t:removeSelf()
        t = nil
        printrecord()
    end

    savebutton = widget.newButton {
        default = "buttonGreen.png",
        over = "buttonGreenOver.png",
        label = "Save",
        embose = true,
        onRelease = saveData
        }

when I try to change the textString from db:exec( [[ INSERT INTO test VALUES (NULL, textString, 30, "unknown")]] ) to a string like “this is a string” it seems to work fine, can anyone help?

  • 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-15T10:25:32+00:00Added an answer on June 15, 2026 at 10:25 am

    Lua will not evaluate textString inside the double brackets… Run this in Corona to see the difference:

    textString="hello world"
    
    
    print([[ INSERT INTO test VALUES (NULL, textString, 30, "unknown")]])
    
    print([[ INSERT INTO test VALUES (NULL,"]]..textString..[[",30,"unknown")]])
    

    Hope this helps.

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

Sidebar

Related Questions

im having a hard time saving the image captured from the webcam using the
I'm having a hard time saving my template to a database and download the
I'm having hard time trying to figure out how to auto-save user data in
I am new here, but I am having hard time figuring out how to
Having a hard time with labels on a ggplot2 plot. Here's a similar plot
I am having a hard time attempting to update a single field without having
I'm having a hard time understanding why you would need asprintf. Here in the
I'm having a hard time wrapping my head around when LINQ accesses the database,
I am having hard time to understand how to make field value unique while
Okay so im having a hard time saving the state of my activity so

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.