0 Replies Latest reply on Feb 8, 2011 7:55 PM by crosbymichael

    SQLite error when space is in Textinput box

    crosbymichael

      I am working on an Air app and using SQLite for data storage.  The db creates and the table creates successfully in my app.  However when I go to insert text from Text Input boxes into the database, it errors.  I have noticed that it will error if I type "My Name" in the input for if it is just one word "myname" no sql error. 

       

      Here is my code and insert statement:

       

      var sqlcreateStatement:String =

      "CREATE TABLE IF NOT EXISTS initsetup ("

      "    deptID INTEGER PRIMARY KEY AUTOINCREMENT, "

      "    deptName CHARACTER(50), "

      "    deptAddress TEXT, " +

      " deptCity TEXT, " +

      " deptState TEXT, " +

      " deptZip INTERGER, " +

      " deptPhone TEXT, " +

      " deptdisPhone TEXT, " +

      " deptFax TEXT, " +

      " deptORI TEXT" +

      ")";

       

      var dbname:String = "setup.db";

       

      var dbinsert:String =

      "INSERT INTO initsetup (deptName, deptAddress, deptCity, deptState, deptZip, deptPhone, deptdisPhone, deptFax, deptORI) "

      "VALUES (" + ti_dept_name.text + "," + ti_dept_address.text + "," +

      ti_dept_city.text + "," + ti_dept_state.text + "," + ti_dept_zip.text + "," +

      ti_dept_phone.text + "," + ti_dis_phone_num.text + "," + ti_fax_num.text + "," +

      ti_dept_ori.text + ")";