dimanche 28 juin 2015

error saving a MAC address in android sqlite

I'm trying to save a MAC address on a table in a SQLite database in android. while trying to save this address, I present the following error, and stores only the first two numbers, that is, after all: do not store anything else, any solution? My code is this:

assume that there is already a record in the table, with value 0:

String sql = "UPDATE preferencias set direc_bluetooth =\"" + Direccion1 + "\""; PreferenciasWrite.execSQL(sql);

Direccion1 = "21:24:14:22:32:34"

El error presentado es: android.database.sqlite.SQLiteException: near ":24": syntax error (code 1): , while compiling: UPDATE preferencias set direc_bluetooth = 21:24:14:22:32:34

1 commentaire:

  1. Try changing the data type of MAC to CHAR(17) this should do the job

    RépondreSupprimer