I am trying to do a FMDB insert with this code:
dbCmd = @"INSERT INTO SiteData (SITE_ID, INITIAL_STA, ELEV, SITE_DESC, LOOP_COUNT, DATE) VALUES(?,?,?,?,?,?)",
txtSiteID.text,
[txtSTA.text floatValue],
[txtElev.text floatValue],
txtSiteDesc.text,
[NSNumber numberWithInt:0],
currentDate;
Each of the 3 text fields that are not modified by the "float value" method call are getting an error saying: "Expression result unused" which is causing the parameter count to be off, which in turn is causing FMDB to crash.
I don't see any problem with the code as written... can someone enlighten me as to what I need to change to get this to work?
Here's the answer:
dbCmd = [NSString stringWithFormat: @"INSERT INTO SiteData (SITE_ID, INITIAL_STA, ELEV, SITE_DESC, LOOP_COUNT, DATE) VALUES(%@, %f, %f, %@, %d, %@)",
txtSiteID.text,
[txtSTA.text floatValue],
[txtElev.text floatValue],
txtSiteDesc.text,
[NSNumber numberWithInt:0],
currentDate];
Works like a champ! Thanks everybody for your input. I appreciate it!