gpt4 book ai didi

android - execSQL 导致语法错误

转载 作者:行者123 更新时间:2023-11-30 03:51:29 25 4
gpt4 key购买 nike

我有以下 execSQL 抛出语法错误并导致我的应用程序崩溃。考虑到我已经转义了单引号和双引号,我不知道为什么。

代码如下:

database.execSQL("insert into " + TABLE_EXERCISES + " (" + COLUMN_NAME + ", " + COLUMN_PRIMARY_MUSCLE + ", " + COLUMN_SECONDARY_MUSCLE + ", " + COLUMN_EQUIPMENT_TYPE + ", " + COLUMN_STEPS + ", " + COLUMN_IMAGES + ") values ('Cable Shrugs', 'Traps', 'None', 'Cable', 'Attach a flat shoulder width bar to the lowest cable pulley. Stand with your feet shoulder width apart. Keep your abs tight and a slight bend in your knees to protect your lower back. Starting with the bar at waist height, raise your shoulders toward your ears as if you\'re saying,\"I don\'t know.\" Hold briefly at the top of the contraction then lower in a slow and controlled manner.', 'cable-shrugs-1.png|cable-shrugs-2.png')");

有人知道吗?

这是日志:

12-29 23:31:54.174: E/AndroidRuntime(1207): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gauvion.gfit/com.gauvion.gfit.RoutinesActivity}: android.database.sqlite.SQLiteException: near "re": syntax error (code 1): , while compiling: insert into exercises(name, primary_muscle, secondary_muscle, equipment_type, steps, images) VALUES ('Cable Shrugs', 'Traps', 'None', 'Cable', 'Attach a flat shoulder width bar to the lowest cable pulley. Stand with your feet shoulder width apart. Keep your abs tight and a slight bend in your knees to protect your lower back. Starting with the bar at waist height, raise your shoulders toward your ears as if you're saying,"I don't know." Hold briefly at the top of the contraction then lower in a slow and controlled manner.', 'cable-shrugs-1.png|cable-shrugs-2.png')

最佳答案

you're

这是你的错误。你没有逃避撇号。据我所知,如果您使用 '' 这将起作用。

注意:对于“使用”和“使用”

试试这个:

database.execSQL("insert into " + TABLE_EXERCISES + " (" + COLUMN_NAME + ", " + COLUMN_PRIMARY_MUSCLE + ", " + COLUMN_SECONDARY_MUSCLE + ", " + COLUMN_EQUIPMENT_TYPE + ", " + COLUMN_STEPS + ", " + COLUMN_IMAGES + ") values ('Cable Shrugs', 'Traps', 'None', 'Cable', 'Attach a flat shoulder width bar to the lowest cable pulley. Stand with your feet shoulder width apart. Keep your abs tight and a slight bend in your knees to protect your lower back. Starting with the bar at waist height, raise your shoulders toward your ears as if you''re saying,""I don''t know."" Hold briefly at the top of the contraction then lower in a slow and controlled manner.', 'cable-shrugs-1.png|cable-shrugs-2.png')");

关于android - execSQL 导致语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14086948/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com