1.下载
System.Data.SQLite: Downloads Page
2.使用示例
using System;
using System.Data.SQLite;
public class SQLiteHelper
{
private readonly string _connectionString;
public SQLiteHelper(string databasePath)
{
_connectionString = $"Data Source={databasePath};Version=3;";
}
public void CreateTable(string tableName, string columnsDefinition)
{
using (var connection = new SQLiteConnection(_connectionString))
{
connection.Open();
string sql = $"CREATE TABLE IF NOT EXISTS {tableName} ({columnsDefinition})";
using (var command = new SQLiteCommand(sql, connection))
{
try
{
command.ExecuteNonQuery();
Console.WriteLine($"Table '{tableName}' created successfully.&