Very good day. I am trying to insert in sqlite with swift by means of a func: nevertheless I get this error: "Value of Type 'DataBaseHandler' has no member 'insert data2'" What would be the error?
NOTE: I have already connected the classes eg: let number_rows = DataBaseHandler (). num_row_regs () status.text = String (number_rows) and fuenciona correctly
let junta = DataBaseHandler().insertar_datos2(add1: "hola", add2: "hola", add3:"hola")
print(junta)
And in DataBaseHandler:
func insertar_datos2(f1: String, f2: String, f3: String) -> String {
databasePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("dires.db")
let contactDB = FMDatabase(path: databasePath as String)
if contactDB.open() {
let insertSQL = "INSERT INTO CONTACTS (name, address, phone) VALUES ('\(f1)', '\(f2)', '\(f3)')"
let result_insert = contactDB.executeUpdate(insertSQL,withArgumentsInArray: nil)
if !result_insert {
self.sucess = "Fallo Al Insertar Registro."
print("Error: \(contactDB.lastErrorMessage())")
} else {
self.sucess = "Listo. Insertado con Èxito"
}
} else {
print("Error: \(contactDB.lastErrorMessage())")
}
return self.sucess
}
}