1.以操作SQLite为例.先下载Dapper,项目引用添加Dapper.dll,然后入下
SQLiteConnectionStringBuilder sb = new SQLiteConnectionStringBuilder(); sb.DataSource = @"D:sqlite.db"; SQLiteConnection con = new SQLiteConnection(sb.ToString()); con.Open(); string sql = "select * from user"; foreach( User u in con.Query<User>(sql)) { Console.WriteLine(u.Name); } con.Close();
时间: 2024-10-24 21:57:23