Android Question Missing Parameter in SQL array

Jay Young

Member
Licensed User
Longtime 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:

edgar_ortiz

Active Member
Licensed User
Longtime 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
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Try this ..
B4X:
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.
 
Upvote 0
Top