1
這個問題是關於使用https://github.com/maxtoroq/DbExtensions無法查詢使用的OleDb和DbExtensions
DbConnection connection = Database.CreateConnection("name=myconx");
var query = SQL.SELECT("u.username").FROM("Users u").WHERE("Id={0}", 1);
IEnumerable<Users> products = connection.Map<Users>(query);
下面的代碼返回null,不知道爲什麼?
getDbProviderFactory(connection);
和這裏的定義沒有關於下一個代碼目的的想法:
static readonly Func<DbConnection, DbProviderFactory> getDbProviderFactory =
(Func<DbConnection, DbProviderFactory>)Delegate.CreateDelegate(typeof(Func<DbConnection, DbProviderFactory>), typeof(DbConnection).GetProperty("DbProviderFactory", BindingFlags.Instance | BindingFlags.NonPublic).GetGetMethod(nonPublic: true));
,這裏是我的連接字符串
<add name="myconx" connectionString="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=ES;Initial Catalog=TestDB;Data Source=ITA-PC\SQLR2" providerName="System.Data.OleDb"/>
非常感謝你 – capadleman 2013-04-21 17:20:08