SqliteManager 1.1.1

dotnet add package SqliteManager --version 1.1.1
                    
NuGet\Install-Package SqliteManager -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SqliteManager" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SqliteManager" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SqliteManager" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SqliteManager --version 1.1.1
                    
#r "nuget: SqliteManager, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SqliteManager@1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SqliteManager&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SqliteManager&version=1.1.1
                    
Install as a Cake Tool

SQLite数据库管理WinForms库

一个完整的SQLite数据库管理库,基于.NET 8和Windows Forms构建。直接引用此NuGet包即可在WinForms项目中实现SQLite数据库浏览、查询和编辑功能,无需安装其他管理工具。

功能特性

  • 📊 数据库浏览 - 查看数据库文件结构、表列表、列信息
  • 🔍 SQL查询 - 执行任意SQL语句并查看结果
  • 📝 数据编辑 - 插入、更新、删除数据记录
  • 🌳 树形视图 - 直观展示数据库和表结构
  • 🎨 现代化UI - 简洁易用的界面设计

安装使用

方法一:引用NuGet包(推荐)


<ItemGroup>
  <PackageReference Include="SqliteManager" Version="1.0.0" />
</ItemGroup>

或使用命令行:

dotnet add package SqliteManager --version 1.0.0

方法二:本地引用DLL

nupkg/SqliteManager.1.0.0.nupkg 解压后,将 lib/net8.0-windows7.0/SqliteManager.dll 添加到项目引用中。

快速开始

示例代码

using SqliteManager;

namespace MyApplication
{
    public partial class MainForm : Form
    {
        private SqliteManagerForm _sqliteManager;

        public MainForm()
        {
            InitializeComponent();
            
            // 方式1:创建完整的数据库管理界面
            _sqliteManager = new SqliteManagerForm();
            _sqliteManager.Dock = DockStyle.Fill;
            Controls.Add(_sqliteManager);
            
            // 方式2:连接到数据库
            _sqliteManager.OpenDatabase(@"C:\path\to\your\database.db");
        }
    }
}

嵌入到其他窗体

// 创建管理器实例
var manager = new SqliteManagerForm();

// 连接到数据库
manager.OpenDatabase(@"C:\database.db");

// 执行查询
DataTable result = manager.ExecuteQuery("SELECT * FROM users");

// 执行非查询语句
int affected = manager.ExecuteNonQuery("INSERT INTO users (name) VALUES ('test')");

// 获取当前数据库信息
var dbInfo = manager.GetCurrentDatabase();

API 参考

SqliteManagerForm

方法 说明
OpenDatabase(string filePath) 打开指定路径的SQLite数据库文件
Connect(string connectionString) 使用连接字符串连接数据库
ExecuteQuery(string sql) 执行SQL查询并返回结果
ExecuteNonQuery(string sql) 执行非查询SQL(INSERT/UPDATE/DELETE)
GetCurrentDatabase() 获取当前数据库信息
IsConnected 是否已连接数据库

SQLiteConnectionManager

属性/方法 说明
IsOpen 是否已打开连接
ConnectionString 当前连接字符串
Open(string connectionString) 打开数据库连接
OpenFile(string filePath) 打开数据库文件
Close() 关闭连接
ExecuteQuery(string sql) 执行查询
ExecuteNonQuery(string sql) 执行非查询
BeginTransaction() 开始事务
CommitTransaction() 提交事务
RollbackTransaction() 回滚事务

SQLiteSchemaReader

方法 说明
ReadSchema(string connectionString) 读取数据库架构信息

数据模型

  • DatabaseInfo: 数据库信息(名称、路径、大小、表集合)
  • TableInfo: 表信息(名称、行数、列集合、建表SQL)
  • ColumnInfo: 列信息(名称、类型、是否非空、默认值、是否主键)

构建说明

# 进入项目目录
cd SqliteManager

# 构建核心库
dotnet build src/SqliteManager.csproj

# 构建并运行示例
dotnet run --project tests/SqliteManager.Sample.csproj

# 打包NuGet
dotnet pack src/SqliteManager.csproj -c Release -o ./nupkg

依赖项

  • .NET 8.0 Windows
  • System.Data.SQLite 1.0.119

许可证

MIT License

作者

Sapiens AI

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 100 8/26/2026
1.1.0 95 8/26/2026
1.0.0 103 8/24/2026