C# - 如何在 SQLite 中获取字符串

问题描述 投票:0回答:2

我会让这件事尽可能简单。 在 MySQL 中是这样的:

string name = myReader.Getstring("student_name");

如何在 SQLite 中执行此操作?仍然是c#。 任何帮助将不胜感激。预先感谢。

c# sqlite getstring
2个回答
0
投票
string name = myReader.GetString(0);

只需确保在代码顶部,在连接之前,您有“string(字符串的名称)=“select name from(表名称)”;”


0
投票

将其包含在您的 using 语句中。

using System.Data;

它提供了一种扩展方法,允许您通过列名而不是序数来获取。

© www.soinside.com 2019 - 2024. All rights reserved.