Android Question Missing Parameter in SQL array

Discussion in 'Android Questions' started by Jay Young, Jul 17, 2015.

  1. Jay Young

    Jay Young Member Licensed User

    i am getting a (missing parameter) in the following sqlite insert into statement

    newID in int
    the rest of the variables are string

    SQLTASK.ExecNonQuery2("INSERT INTO eventbook VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object(newID, &"'"& StartTime, &"'"& EndTime, &"'"& lblMonth, &"'"& lblDay, &"'"& lblYear, &"'"& entSubject, &"'"& evtNotes, &"'"& usernameSCH &"'"&))
     
    Last edited: Jul 17, 2015
  2. edgar_ortiz

    edgar_ortiz Active Member Licensed User

    Hi Jay,

    Your problem is that you only SEND two parameters (NewID and "a concatenation of data"), that's because "&" concatenates

    And consider : You Don't need to quote the parameters

    Regards,

    Edgar
     
  3. mangojack

    mangojack Well-Known Member Licensed User

    Try this ..
    Code:
    SQLTASK.ExecNonQuery2("INSERT INTO eventbook VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"Array As Object(newID, StartTime, EndTime, lblMonth.Text, lblDay.Text, lblYear.Text,  entSubject,  evtNotes, usernameSCH ))
    As @edgar_ortiz stated with .ExecNonQuery2 you dont have to use quotes within the array.
    I am presuming lblMonth ... Day ...and Year are views , so you have to include the .Text property.
     
    edm68 and DonManfred like this.
  4. Jay Young

    Jay Young Member Licensed User

    thanks, I was trying to concatenate everything.
     
Loading...