想通过oledb或者odbc连接数据库
connectionString尝试了很多写法,都不成功
该怎么写?
错误信息
‘this.Database.CurrentTransaction’ threw an exception of type 'System.Data.Entity.Core.ProviderIncompatibleException'
web.config配置文件中配置: <connectionString>
<add name="TestOledb" providerName="System.Data.OledDB">
connectionString="Provider=SAOLEDB.17;uid=dba;pwd=sql;Links=TcpIp(host=.;serverport=5000);eng=demodb"/>
<add name="TestODBC" providerName="System.Data.Odbc">
connectionString="Driver={SQL Anywhere 17};uid=dba;pwd=sql;dsn=demo db;database=demodb;"/>
<connectionString>
创建dbcontextpublic class DemoDB :DbContext
{
public DemoDB() : base("name=TestOledb") //用TestODBC也一样的错误信息
{}
}
connectionString尝试了很多写法,都不成功
该怎么写?
错误信息
‘this.Database.CurrentTransaction’ threw an exception of type 'System.Data.Entity.Core.ProviderIncompatibleException'
web.config配置文件中配置: <connectionString>
<add name="TestOledb" providerName="System.Data.OledDB">
connectionString="Provider=SAOLEDB.17;uid=dba;pwd=sql;Links=TcpIp(host=.;serverport=5000);eng=demodb"/>
<add name="TestODBC" providerName="System.Data.Odbc">
connectionString="Driver={SQL Anywhere 17};uid=dba;pwd=sql;dsn=demo db;database=demodb;"/>
<connectionString>
创建dbcontextpublic class DemoDB :DbContext
{
public DemoDB() : base("name=TestOledb") //用TestODBC也一样的错误信息
{}
}
用odbc或者oledb可以吗
用odbc或者oledb可以吗
好像不支持的吧
用odbc或者oledb可以吗
你如果理解EF的原理,就知道应该不行。ORM是需要SQL翻译的,那么翻译SQL的代码在哪里?不可能是.net自带的dll,必须是新的支持库dll。
sqlserver是:EntityFramework.SqlServer.dll
mysql是:MySql.Data.Entity.EF6.dll那么,你找到 EntityFramework.Odbc.dll了吗?
System.Data.SQLite.EF6.dll
https://blog.csdn.net/apollokk/article/details/5609182