添加项目文件。

This commit is contained in:
xyy
2026-01-16 20:53:33 +08:00
parent a75be0a011
commit a254118c27
92 changed files with 36090 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
using SQLite;
using System;
using System.IO;
namespace
{
public class SQLiteHelper
{
private readonly SQLiteConnection _db;
public SQLiteHelper()
{
string dbPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data.db");
_db = new SQLiteConnection(dbPath);
// 自动创建表(不存在时创建)
_db.CreateTable<Experiment>();
}
// 插入数据的方法,直接传模型对象
public void InsertExperimentData(Experiment data)
{
try
{
_db.Insert(data);
}
catch (Exception ex)
{
// 捕获异常,方便调试
throw new InvalidOperationException("插入数据失败: " + ex.Message, ex);
}
}
}
}
// 对应 Experiments 表,字段和表结构完全一致
public class Experiment
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
public string Sex { get; set; }
public int? Age { get; set; } // 可空类型
public string IdNumber { get; set; }
public string Company { get; set; }
public int? CompanyAge { get; set; } // 可空类型
public string Date { get; set; }
public string Time { get; set; }
public string ExperName { get; set; }
//public string ExperNum { get; set; }
public string ExperType { get; set; }
public string MaskType { get; set; }
public string TestStatus { get; set; }
public float HuanJingWenDu { get; set; }
public float HuanJingShiDu { get; set; }
public float BenDiNongDu { get; set; }
public float TsiIndoorAgv { get; set; }
public float TsiOutdoorAgv { get; set; }
public float Xieloulv { get; set; }
}