Created
October 31, 2013 12:47
-
-
Save kiyokura/7249116 to your computer and use it in GitHub Desktop.
こんな感じで、Dapper使ってもGlimpse.AdoでトレースOK。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SQL Server CEで試した例。SQL Serverの場合はプロバイダ名をSystem.Data.SqlClientに。 | |
var factory = System.Data.Common.DbProviderFactories.GetFactory("System.Data.SqlServerCe.4.0"); | |
using (var cn = factory.CreateConnection()) | |
{ | |
cn.ConnectionString = "接続文字列"; | |
cn.Open(); | |
var ret = cn.Query("SELECT * FROM users WHERE Age > @Age", new { Age = 20 }); | |
foreach (var r in ret) | |
{ | |
// 内容読みだすよ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment