From 3a471ae651b228231bebb3a2d438baa1d4ac0261 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 21 十一月 2025 08:57:52 +0800
Subject: [PATCH] 优化
---
HMI.Core/Util/SqliteHelper.cs | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/HMI.Core/Util/SqliteHelper.cs b/HMI.Core/Util/SqliteHelper.cs
index 34502b6..02c0dbb 100644
--- a/HMI.Core/Util/SqliteHelper.cs
+++ b/HMI.Core/Util/SqliteHelper.cs
@@ -1,15 +1,13 @@
锘縰sing System;
using System.Collections.Generic;
using System.Data;
-using System.Data.Common;
-using System.Data.Odbc;
using System.Data.SQLite;
namespace HMI.Core.Util
{
- public class SqliteHelper
+ public class SqliteHelper:IDisposable
{
- private string DataBaseFile = string.Empty;
+ public string DataBaseFile { get; private set; } = string.Empty;
private string ConnectString = string.Empty;
@@ -20,7 +18,7 @@
public SqliteHelper(string DBFile)
{
DataBaseFile = DBFile;
- ConnectString = "DataSource=" + DataBaseFile + ";Version=3;Pooling=False;Max Pool Size=100";
+ ConnectString = "DataSource=" + DataBaseFile + ";Version=3;Pooling=False;Max Pool Size=100;";
conn = new SQLiteConnection(ConnectString);
cmd = new SQLiteCommand(conn);
}
@@ -188,7 +186,7 @@
}
catch (Exception ex)
{
- throw new Exception("鑾峰彇瀛楁鍚嶇О澶辫触:" + ex.Message);
+ throw new Exception("鑾峰彇琛ㄥ瓧娈靛悕绉板け璐�:" + ex.Message);
}
}
@@ -210,7 +208,7 @@
}
catch (Exception ex)
{
- throw new Exception("鑾峰彇瀛楁鍚嶇О澶辫触:" + ex.Message);
+ throw new Exception("鑾峰彇琛ㄥ悕澶辫触:" + ex.Message);
}
}
@@ -231,5 +229,10 @@
conn.Close();
}
}
+
+ public void Dispose()
+ {
+ this.Close();
+ }
}
}
--
Gitblit v1.9.1