[英]How to Update a column in Sqlite in Universal Windows Application
when i am trying to update a column in my Windows Application, i am getting error, i am using this query. 当我尝试更新Windows应用程序中的列时,出现错误,我正在使用此查询。
string qu = "UPDATE Registration_class SET numOfSeat = 300"; await MainPage.con.UpdateAsync(qu);
Here is the Error Screenshot 这是错误截图
If you need any other info please tell me. 如果您需要任何其他信息,请告诉我。 Thankyou.
谢谢。
I'm not sure which sqlite version that you're using. 我不确定您使用的是哪个sqlite版本。 Then if just according to the error information, you should specify the
PrimaryKey
for your table. 然后,如果仅根据错误信息,则应为表指定
PrimaryKey
。
For example, like the following: 例如,如下所示:
public class Registration_class
{
[PrimaryKey, AutoIncrement]
public int Id {get;set;}
public string name { get; set; }
public int numOfSeat { get; set; }
public string password { get; set; }
}
Then I will point out another wrong place in your code. 然后,我将指出您代码中的另一个错误位置。 If you want to execute the sql statement directly, you should use
db.Execute("UPDATE Registration_class SET numOfSeat = 300");
如果要直接执行sql语句,则应使用
db.Execute("UPDATE Registration_class SET numOfSeat = 300");
method, not Update
method. 方法,而不是
Update
方法。
My code sample was based on Diederik's blog: Using SQLite on the Universal Windows Platform 我的代码示例基于Diederik的博客: 在通用Windows平台上使用SQLite
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.