SQLite 创建数据库插入数据库数据DEMO
注意事项:SQLsugar版本(4.9.9.11) and SQLite版本(1.0.113.0) and System.Data.SQLite.EF6 版本(1.0.113.0)
and System.Data.SQLite.Linq(1.0.113.0) and .NET版本(4.0)
using Sqlite_AND_SqlSuager.Entity;
using Sqlite_AND_SqlSuager.SqlDB;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Sqlite_AND_SqlSuager
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlSugarClient _db = SqliteDB.GetDB();
List<User> _lstClass = new List<User>();
private void 创建数据库_Click(object sender, EventArgs e)
{
try
{
SqliteDB.CreateDB(true);
textBox1.Text += "创建数据库完成!" + System.Environment.NewLine; ;
}
catch (Exception ex)
{
textBox1.Text += "数据库创建失败!" + ex.Message + System.Environment.NewLine;
}
}
private void 查询数据_Click(object sender, EventArgs e)
{
try
{
_lstClass = new List<User>();
_lstClass = _db.Queryable<User>().ToList();
dataGridView1.DataSource = _lstClass;
}
catch (Exception ex)
{
textBox1.Text