如何将UWP应用中的SQLite数据库列分配默认字符串值?

发布于 2025-01-25 10:32:47 字数 266 浏览 0 评论 0原文

因此,我有一个与数据库通信的UWP,我有一个具有列名称位置的表。我想在每次创建AA行时分配一个默认值。

我在数据库中创建列的方式是

//travel is a table name. id and location is a column in that table
public class travel
{
    public int id { get; set; }
    public string location{get; set;}
}

So i've a UWP which communicates with a database, i've a table which has a column names location. I want to assign a default value to that every time a a row is created.

The way i've created columns in the database is

//travel is a table name. id and location is a column in that table
public class travel
{
    public int id { get; set; }
    public string location{get; set;}
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原谅过去的我 2025-02-01 10:32:47

您可以这样做:

public class travel
{
    public int id { get; set; } = 0;
    public string location { get; set; } = "";
}

You can do it like this:

public class travel
{
    public int id { get; set; } = 0;
    public string location { get; set; } = "";
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文