我是 LiteDB 的新手,但在使用繁琐的 CSV 文件后,它似乎非常适合我的应用程序,但我无法在 Windows 窗体 DataGridView 中显示数据。
我的 LiteDB 数据库在存储数据方面运行良好,但需要帮助来显示数据。
这是我的 POCO 和用户数据存储方法:
public class Preset
{
[BsonId]
public int _id { get; set; }
public string Name { get; set; }
public int X { get; set; }
public int Y { get; set; }
public int Z { get; set; }
public int Foam { get; set; }
}
public void DataBase()
{
using (var db = new LiteDatabase(DB))
{
var col = db.GetCollection<Preset>("presets");
var preset = new Preset
{
Name = CustomPresetName.Text,
X = Int16.Parse(CustomX.Text),
Y = Int16.Parse(CustomY.Text),
Z = Int16.Parse(CustomZ.Text),
Foam = Int16.Parse(Foam.Text)
};
col.Insert(preset);
}
}
我只是尝试将 DataGridView 与对象作为数据源链接,但它不显示数据,只显示标题。我也上网寻找类似的问题或答案,但它似乎是一个相当原始的。
任何有关让数据显示在 DataGridView 中的帮助表示赞赏。