Microsoft.ApplicationBlocks.Data.ODBCHelper?

发布于 2024-07-06 07:25:46 字数 182 浏览 11 评论 0原文

我发现提到了 ODBC 存在的数据应用程序块,但似乎在任何地方都找不到它。 如果我没有 Access DB 应用程序块的副本,我也不会相信它曾经存在。

有人知道从哪里下载 DLL 或代码库吗?

--更新:它不包含在数据应用程序块的 v1、v2 或企业库版本中,

谢谢, 布赖恩·斯旺森

I've found mention of a data application block existing for ODBC, but can't seem to find it anywhere. If i didn't have a copy of the Access DB application block I wouldn't believe it ever existed either.

Anyone know where to download either the DLL or the code-base from?

--UPDATE: It is NOT included in either the v1, v2, or Enterprise Library versions of the Data ApplicationBlocks

Thanks,
Brian Swanson

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野鹿林 2024-07-13 07:25:46

您有兴趣在哪个版本的 .net 上使用 ODBC 块?

企业库有一个数据访问组件。 它对于 SQL、Oracle 和 ODBC 很有用。 只需在 .config 文件中设置不同的提供程序名称
EX:

"System.Data.Odbc" />

此时,数据访问代码已“标准化”,并且对于 SQL、Oracle 和 ODBC

EX 来说看起来是相同的:

Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling

    Public Class MyClass

    Private dbMyDatabase As Database

    dbMyDatabase = DatabaseFactory.CreateDatabase("MyConnection")

    Public Function GetMyData(ByVal FacilityCode As String) As Data.DataSet

            Try
                Dim SQL As String
                SQL = "SELECT * from MyDataTable"
                Dim cmd As Data.Common.DbCommand = dbMyDatabase.GetSqlStringCommand(SQL)
                Return dbMyDatabase.ExecuteDataSet(cmd)
            Catch ex As Exception
                ExceptionPolicy.HandleException(ex, "All")
                Throw
            End Try
        End Function 

    End Class

最新 Enterprise Library 的地址是:
http://msdn.microsoft.com/en-us/library/cc467894。 aspx

假设您使用的是 .net 3x。

另请注意,我们在上面的代码中使用了异常处理块。

Which version of .net are you interested in using the ODBC block on?

The Enterprise library has a Data Access component. It is useful on SQL, Oracle, and ODBC. Just set a different provider name in the .config file
EX:

<add name="MyConnection" connectionString="Dsn=Datasource;uid=UserID;pwd=Password"
providerName="System.Data.Odbc" />

At that point, the data access code is "standardized" and looks identical for SQL, Oracle, and ODBC

EX:

Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling

    Public Class MyClass

    Private dbMyDatabase As Database

    dbMyDatabase = DatabaseFactory.CreateDatabase("MyConnection")

    Public Function GetMyData(ByVal FacilityCode As String) As Data.DataSet

            Try
                Dim SQL As String
                SQL = "SELECT * from MyDataTable"
                Dim cmd As Data.Common.DbCommand = dbMyDatabase.GetSqlStringCommand(SQL)
                Return dbMyDatabase.ExecuteDataSet(cmd)
            Catch ex As Exception
                ExceptionPolicy.HandleException(ex, "All")
                Throw
            End Try
        End Function 

    End Class

The address for the latest Enterprise Library is:
http://msdn.microsoft.com/en-us/library/cc467894.aspx

This is assuming you are using .net 3x.

Also note that we are using the Exception Handling block in the above code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文