Return null in SQLite

0

I try to save the name of a subject along with other information, but for some reason the name of the subject does not save. I try to save in the following way:

Nombre_Asig = Horario[i].NombAsig;
Asig_Nsp = Nombre_Asig.replace(/\s+/g, '');
Asig_Grupo = (Asig_Nsp+'-'+Horario[i].Grupo);

For example, if the name of the subject is Database and the group that the teacher has is 2 , then I want to save it like this:

Basededatos-2

The table is as follows:

crearTablaGrupo = "CREATE TABLE IF NOT EXISTS GruposP(Fila integer primary key, Cedula text, Nombre text," +
                  "Apellido text, Nota1 float, Nota2 float, Nota3 float, Habilitacion float, Grupoasig text)";

insertarGrupos = "INSERT INTO GruposP(Fila, Cedula, Nombre, Apellido, Nota1, Nota2, Nota3, Habilitacion, Grupoasig)" +
                 "VALUES(?,?,?,?,?,?,?,?,?)";

I counted the question marks, and they must be the same number as the number of fields in the table, in this case 10 .

To insert the groups, it is as follows:

$cordovaSQLite.execute(db, insertarGrupos, [Cantidad_Estu, Lista[k].CeduEstu, Lista[k].NombEstu, Lista[k].ApelEstu,
                                       Lista[k].Nota1, Lista[k].Nota2, Lista[k].Nota3], Lista[k].Habilitacion, Asig_Grupo);        

To get the information I use the following query

sqlConsulta = "SELECT * FROM GruposP"; 

information is as follows:

0: Object
 apellido: "Vides"
 cedula: "11223344"
 grupo: null
 nombre: "Diego"
 puesto: 1

1: Object
 apellido: "Vides"
 cedula: "11223344"
 grupo: null
 nombre: "Diego"
 puesto: 2

The student is repeated, but it is only because he is teaching two subjects with the same teacher.

Thank you in advance for any help.

    
asked by Pedro Miguel Pimienta Morales 20.05.2016 в 02:04
source

1 answer

0

You should check the data type before inserting it into the table, but if the code you are using is exactly what you are showing, in this you have an error:

$cordovaSQLite.execute(db, insertarGrupos, [Cantidad_Estu, Lista[k].CeduEstu, Lista[k].NombEstu, Lista[k].ApelEstu,
                                       Lista[k].Nota1, Lista[k].Nota2, Lista[k].Nota3], Lista[k].Habilitacion, Asig_Grupo);  

List [k] .Note3] overrides the ']', although this should throw you an execution error.

If the same is another mistake, if you give me more information about the problem I could help you better!

Bye!

    
answered by 07.06.2016 в 02:38