参考:https://blog.csdn.net/penghao_1/article/details/82624453
首先创建两个类(数据库对象映射)
public class BOOKINFO
{
public string user_id {
get; set; }
public string book_id {
get; set; }
public int book_price {
get; set; }
public int user_age {
get; set; }
public string user_habbit {
get; set; }
}
public class JOINTEST
{
public string user_id;
public string user_habbit;
}
获取连接字符串,用于之后连接数据库
private static string LoadConnectString(string id = "F:\\C#联合SQLite学习\\C#DapperSQLite\\WindowsFormsApplication1\\AllCode.db")
{
SQLiteConnection dbConnection = new SQLiteConnection();
SQLiteConnectionStringBuilder dbConnectionstr = new SQLiteConnectionStringBuilder();
dbConnectionstr.DataSource = id;
return dbConnectionstr.ToString();
}
插入单值
public static void MineInsert(BOOKINFO bookinfo)
{
using (IDbConnection cnn =

本文介绍了使用Dapper库进行SQLite数据库的基本操作,包括创建数据库对象映射类、建立连接、插入单值和多值、删除指定及多条数据、查询操作以及执行多条SQL语句的方法。
1092

被折叠的 条评论
为什么被折叠?



