【发布时间】:2021-10-31 13:35:48
【问题描述】:
无论我如何尝试,我都会不断收到此错误
E/SQLiteLog( 9445): (20) statement aborts at 5: [INSERT Into Profile (mac,image,name,age,nationality,profession,about) VALUES ('0.0.0.0.0.0','/data/user/0/com.shades.flidar/cache/scaled_image_picker5826102720138113893.jpg','test','35',
E/SQLiteQuery( 9445): exception: datatype mismatch (code 20 SQLITE_MISMATCH); query: INSERT Into Profile (mac,image,name,age,nationality,profession,about) VALUES ('0.0.0.0.0.0','/data/user/0/com.test.test/cache/scaled_image_picker5826102720138113893.jpg','test','35','test','test','test');
E/flutter ( 9445): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: DatabaseException(datatype mismatch (code 20 SQLITE_MISMATCH)) sql 'INSERT Into Profile (mac,image,name,age,nationality,profession,about) VALUES ('0.0.0.0.0.0','/data/user/0/com.test.test/cache/scaled_image_picker5826102720138113893.jpg','test','35','test','test','test');' args []
这是代码:
customQuery("CREATE TABLE Profile ("
"mac TEXT,"
"image TEXT,"
"name TEXT,"
"age TEXT,"
"nationality TEXT,"
"profession TEXT,"
"about TEXT"
")");
onPressed: () {
profile.add(Profile(
mac: _platformVersion,
image: imagePath,
name: nameController.text,
age: ageController.text,
nationality: nationalityController.text,
profession: professionController.text,
about: aboutController.text));
DBProvider.db.customQuery("INSERT Into Profile (mac,image,name,age,nationality,profession,about)"
" VALUES ('${profile[0].mac}','${profile[0].image}',"
"'${profile[0].name}','${profile[0].age}','${profile[0].nationality}',"
"'${profile[0].profession}','${profile[0].about}');");
},
我真的不知道为什么,请帮忙! 谢谢!
【问题讨论】:
标签: android ios database flutter sqlite