title: How to insert entry into SQLite database
body: <p>I'm trying to take some data from my View and make an entry into my SQLite database in my android app.</p>
  
  <pre><code>    SQLiteDatabase db = openOrCreateDatabase("SemesterDB", MODE_PRIVATE, null);
      db.execSQL("CREATE TABLE IF NOT EXISTS Semesters (Session VARCHAR, YearStart INT," +
              " MonthStart INT, DayStart INT,YearEnd INT, MonthEnd INT, DayEnd INT )");
  
      //extract session from view
      Spinner sessionSpinner = (Spinner) findViewById(R.id.sessionSpinner);
      String session = (String) sessionSpinner.getSelectedItem();
  
      //extract start date from view
      DatePicker startDatePicker = (DatePicker) findViewById(R.id.semesterStartDate);
      int startDay = startDatePicker.getDayOfMonth();
      int startMonth = startDatePicker.getMonth();
      int startYear = startDatePicker.getYear();
  
      //extract end date from view
  DatePicker endDatePicker = (DatePicker) findViewById(R.id.semesterEndDate);
      int endDay = startDatePicker.getDayOfMonth();
      int endMonth = startDatePicker.getMonth();
      int endYear = startDatePicker.getYear();
  
      String sessionName = (String) session+" "+startYear;
  
      db.execSQL("INSERT INTO Semesters VALUES(sessionName,startYear,startMonth,startDay,endYear,endMonth,endDay);");
      db.close(); 
  </code></pre>
  
  <p>--so when i hard code values into the db.execSQL("INSERT..... line, it works just well but when i try and plug in variables with stored values, it doesnt. Any ideas?</p>
  
  <p>This is for an android 2.3 application being written in eclipse juno.</p>