为什么前一个execsql(sql)语句增加不进去???


create table person_data(id integer primary key autoincrement, name text, age integer, gonghao integer);

        String name = "lisi";
        int age = 11;
        int gonghao = 1111;
        ma_db.execSQL("insert into person_data(name, age, gonghao)values(" +name+ "," +age+ "," +gonghao+ ")");
        ma_db.execSQL("insert into person_data(name, age, gonghao)values('lisi', 11, 1111)");

ma_db.execSQL("insert into person_data(name, age, gonghao)values('" +name+ "'," +age+ "," +gonghao+ ")");应该是文本的name少一对单引号

"insert into person_data(name, age, gonghao)values('" +name+ "'," +age+ "," +gonghao+ ")"

不确定你用的是什么语言,但是建议用SQL占位符来替换你现在的拼接。

拼接容易导致SQL注入问题。