Dapper C# 访问SQLite

时间:2015-03-12 20:39:47   收藏:0   阅读:3360

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();

 

原文:http://www.cnblogs.com/bqh10086/p/4333359.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!