2014-09-12 104 views
-1
var user = await db.QueryAsync<individual>("insert into usersinfo (Image) values ('" +img+ "') where Id=" +userID); 

這是錯誤:凡在INSERT語句中使用SQLite

Additional information: near "where": syntax error

+1

img和userID的值是什麼 – RyPope 2014-09-12 12:19:51

+0

表的設計在哪裏?用戶信息有id字段,它是什麼類型?發佈相關信息很難嗎? – Reniuz 2014-09-12 12:20:44

+1

你想插入還是更新?不清楚給我。 – 2014-09-12 12:49:13

回答

0

SQL支持更新命令,你可以使用它嗎?

UPDATE 
    Table 
SET 
    Field = VALUE 
WHERE 
    Id = userID 
0

在SQL insert命令不支持where條款,除非與insert into ... select形式使用。

你的聲明似乎不以特色insert into select形式,所以它應該被設置爲:

 insert into usersinfo (Image) values ('" +img+ "') 
0

我不是sqllite專家,但在SQL有INSERT INTO聲明:

INSERT INTO table1 
col1, 
col2, 
col3 
    SELECT col1, col2, col3 
    FROM table1 
    WHERE ...; 

Reference