All pastes #2104613 Raw Edit

Something

public text v1 · immutable
#2104613 ·published 2012-01-20 23:15 UTC
rendered paste body
    Private Function GetHibernateSqlDialect() As String

        Try
            ' Retrieve the SQL version (as a dataset) from database
            Dim tableName As String = "version"
            Dim theDataSet As DataSet = DatabaseHelper.ExecuteSimpleQuery(GDatabaseInfo.DatabaseType, "SELECT @@VERSION", tableName, True)

            ' Resolve the proper dialect based on the data we retrieved
            Dim strVersion As String = theDataSet.Tables(tableName).Rows(0).Item(0).ToString()
            If strVersion.Contains("Microsoft SQL Server 2005") Or strVersion.Contains("Microsoft SQL Server 2008") Then
                Return "NHibernate.Dialect.MsSql2005Dialect"
            Else
                Return "NHibernate.Dialect.MsSql2000Dialect"
            End If
        Catch e As Exception
            Trace.TraceError("Could not resolve SQL Dialect.  Defaulting to SQL 2000.  Error:\r\n{0}", e)
            Return "NHibernate.Dialect.MsSql2000Dialect"
        End Try
    End Function