C# Dapper

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(sql))
{
     Console.WriteLine(u.Name);
}
con.Close();


你可能感兴趣的:(C#,Asp.net)