简体   繁体   English

如何在通用Windows应用程序中的Sqlite中更新列

[英]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.

相关问题 如何在通用窗口中更新通知 - how to update notification in universal windows 如何将现有的 SQLite 数据库放入应用程序的本地数据存储中,以便在通用 Windows 平台应用程序中使用? - How do you place an exisiting SQLite database into an application's local data store for use in a Universal Windows Platform application? 更新本地sqlite db Windows Phone 8应用程序 - Update local sqlite db windows phone 8 application 使用SQLite的通用Windows应用 - Universal Windows App Using SQLite 如何从Universal Windows App中的sqlite查询结果填充列表 - How to populate a List from results of sqlite query in Universal Windows App 如何在Windows Universal应用程序(Windows 10)中的markdowntextblock中设置聊天对话的格式 - How to format chat conversations in markdowntextblock in Windows Universal application (windows 10) 如何在通用Windows应用程序中更新WebView页面控件值 - How to update webview page control value in universal windows app 如何在 Windows 10 通用应用程序上获取配对的蓝牙设备列表 - How to get list of paired bluetooth devices on Windows 10 Universal Application C#通用Windows应用程序如何从互联网获取时间 - C# Universal Windows Application How to get time from internet 如何为通用Windows应用程序设置固定的窗口大小 - How to set fixed window size for Universal Windows Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM