简体   繁体   English

.NET Standard 2.0 连接Access数据库

[英].NET Standard 2.0 Connect to Access Database

I'm trying to copy some records from a MS Sql Database to a new MS Access file.我正在尝试将一些记录从 MS Sql 数据库复制到新的 MS Access 文件。 Unfortunately, my application is in .NET Standard 2.0 (as opposed to .NET Core or Framework, which would be simple to implement OleDb connection.) Also, I need to be able to build to 32-bit or 64-bit, so ADOX is not an option.不幸的是,我的应用程序在 .NET 标准 2.0 中(而不是 .NET 核心或框架,这很容易实现 OleDb 连接。)另外,我需要能够构建到 32 位或 64 位,所以 ADOX 不是一个选项。

Does anyone know how I can open a connection to access through .NET Standard 2.0?有谁知道我如何打开连接以通过 .NET 标准 2.0 进行访问? Thanks!谢谢!

Your timing couldn't have been better.你的时机再好不过了。 Just days ago, as of writing this, version 4.6.0 of the System.Data.OleDb package came out of preview.就在几天前,截至撰写本文时, System.Data.OleDb package 的 4.6.0 版已发布预览版。

It targets two TFMs.它针对两个 TFM。 The effect is different depending on which framework your assembly targets and thus which System.Data.OleDb TFM is restored for it.效果会有所不同,具体取决于您的程序集所针对的框架以及为其恢复的System.Data.OleDb TFM。

  • net461 - If you target .NET Framework 4.6.1+, it will restore an assembly that has has type forwarders to the types in the System.Data.OleDb namespace in the .NET Framework's System.Data asssembly. net461 - 如果您以 .NET 框架 4.6.1+ 为目标,它会将具有类型转发器的程序集还原到 .NET 框架的System.Data程序集中的System.Data.OleDb命名空间中的类型。

  • netstandard2.0 - If you target .NET Standard 2.0+, it will restore an assembly that contains the actual implementation of the OLEDB provider. netstandard2.0 - 如果您的目标是 .NET 标准 2.0+,它将恢复包含 OLEDB 提供程序的实际实现的程序集。

Although .NET Framework 4.6.1 supports .NET Standard 2.0, the net461 TFM is more specific so it'll copy the assembly that contains the type forwarders and you'll get the Framework's implementation.尽管 .NET 框架 4.6.1支持.NET 标准 2.0,但 net461 TFM 更具体,因此它将复制包含类型转发器的程序集,您将获得框架的实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM