当前位置: 首页>>代码示例>>C#>>正文


C# OleDbConnection.GetDataSourcePropertyValue方法代码示例

本文整理汇总了C#中System.Data.OleDb.OleDbConnection.GetDataSourcePropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbConnection.GetDataSourcePropertyValue方法的具体用法?C# OleDbConnection.GetDataSourcePropertyValue怎么用?C# OleDbConnection.GetDataSourcePropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.OleDb.OleDbConnection的用法示例。


在下文中一共展示了OleDbConnection.GetDataSourcePropertyValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetIdentifierCase

        private void SetIdentifierCase(string columnName, int propertyID, DataRow row, OleDbConnection connection)
        {
            object dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, propertyID);
            IdentifierCase unknown = IdentifierCase.Unknown;
            if (dataSourcePropertyValue != null)
            {
                switch (((int) dataSourcePropertyValue))
                {
                    case 1:
                    case 2:
                    case 8:
                        unknown = IdentifierCase.Insensitive;
                        break;

                    case 4:
                        unknown = IdentifierCase.Sensitive;
                        break;
                }
            }
            row[columnName] = unknown;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:OleDbMetaDataFactory.cs

示例2: GetSupportMultipleResults

 internal bool GetSupportMultipleResults(OleDbConnection connection) {
     bool supportMultipleResults = _supportMultipleResults;
     if (!_hasSupportMultipleResults) {
         object value = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_MULTIPLERESULTS);
         if (value is Int32) {// not OleDbPropertyStatus
             supportMultipleResults = (ODB.DBPROPVAL_MR_NOTSUPPORTED != (int) value);
         }
         _supportMultipleResults = supportMultipleResults;
         _hasSupportMultipleResults = true;
     }
     return supportMultipleResults;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:oledbconnectionstring.cs

示例3: GetDataSourceInformationTable

        private DataTable GetDataSourceInformationTable(OleDbConnection connection, OleDbConnectionInternal internalConnection)
        {
            string str3;
            string str4;
            if (base.CollectionDataSet.Tables[DbMetaDataCollectionNames.DataSourceInformation] == null)
            {
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.DataSourceInformation);
            }
            DataTable table = base.CloneAndFilterCollection(DbMetaDataCollectionNames.DataSourceInformation, null);
            if (table.Rows.Count != 1)
            {
                throw ADP.IncorrectNumberOfDataSourceInformationRows();
            }
            DataRow row = table.Rows[0];
            string literalInfo = internalConnection.GetLiteralInfo(3);
            string unescapedString = internalConnection.GetLiteralInfo(0x1b);
            if (literalInfo != null)
            {
                StringBuilder builder3 = new StringBuilder();
                StringBuilder escapedString = new StringBuilder();
                ADP.EscapeSpecialCharacters(literalInfo, escapedString);
                builder3.Append(escapedString.ToString());
                if ((unescapedString != null) && (unescapedString != literalInfo))
                {
                    builder3.Append("|");
                    escapedString.Length = 0;
                    ADP.EscapeSpecialCharacters(unescapedString, escapedString);
                    builder3.Append(escapedString.ToString());
                }
                row[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = builder3.ToString();
            }
            else if (unescapedString != null)
            {
                StringBuilder builder4 = new StringBuilder();
                ADP.EscapeSpecialCharacters(unescapedString, builder4);
                row[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = builder4.ToString();
            }
            object dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 40);
            if (dataSourcePropertyValue != null)
            {
                row[DbMetaDataColumnNames.DataSourceProductName] = (string) dataSourcePropertyValue;
            }
            row[DbMetaDataColumnNames.DataSourceProductVersion] = base.ServerVersion;
            row[DbMetaDataColumnNames.DataSourceProductVersionNormalized] = base.ServerVersionNormalized;
            row[DbMetaDataColumnNames.ParameterMarkerFormat] = "?";
            row[DbMetaDataColumnNames.ParameterMarkerPattern] = @"\?";
            row[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;
            dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0x2c);
            GroupByBehavior unknown = GroupByBehavior.Unknown;
            if (dataSourcePropertyValue != null)
            {
                switch (((int) dataSourcePropertyValue))
                {
                    case 1:
                        unknown = GroupByBehavior.NotSupported;
                        break;

                    case 2:
                        unknown = GroupByBehavior.ExactMatch;
                        break;

                    case 4:
                        unknown = GroupByBehavior.MustContainAll;
                        break;

                    case 8:
                        unknown = GroupByBehavior.Unrelated;
                        break;
                }
            }
            row[DbMetaDataColumnNames.GroupByBehavior] = unknown;
            this.SetIdentifierCase(DbMetaDataColumnNames.IdentifierCase, 0x2e, row, connection);
            this.SetIdentifierCase(DbMetaDataColumnNames.QuotedIdentifierCase, 100, row, connection);
            dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0x55);
            if (dataSourcePropertyValue != null)
            {
                row[DbMetaDataColumnNames.OrderByColumnsInSelect] = (bool) dataSourcePropertyValue;
            }
            DataTable table2 = internalConnection.BuildInfoLiterals();
            if (table2 != null)
            {
                DataRow[] rowArray = table2.Select("Literal = " + 0x11.ToString(CultureInfo.InvariantCulture));
                if (rowArray != null)
                {
                    object obj4 = rowArray[0]["InvalidChars"];
                    if (obj4.GetType() == typeof(string))
                    {
                        string str6;
                        string invalidChars = (string) obj4;
                        object obj3 = rowArray[0]["InvalidStartingChars"];
                        if (obj3.GetType() == typeof(string))
                        {
                            str6 = (string) obj3;
                        }
                        else
                        {
                            str6 = invalidChars;
                        }
                        row[DbMetaDataColumnNames.IdentifierPattern] = this.BuildRegularExpression(invalidChars, str6);
                    }
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:OleDbMetaDataFactory.cs

示例4: GetSqlSupport

 internal int GetSqlSupport(OleDbConnection connection) {
     int sqlSupport = _sqlSupport;
     if (!_hasSqlSupport) {
         object value = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_SQLSUPPORT);
         if (value is Int32) { // not OleDbPropertyStatus
             sqlSupport = (int) value;
         }
         _sqlSupport = sqlSupport;
         _hasSqlSupport = true;
     }
     return sqlSupport;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:oledbconnectionstring.cs

示例5: SetIdentifierCase

        private void SetIdentifierCase(string columnName, int propertyID, DataRow row, OleDbConnection connection) {

            object property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo,propertyID);
            IdentifierCase identifierCase = IdentifierCase.Unknown;
            if (property != null) {
                int propertyValue = (int)property;
                switch (propertyValue) {
                case ODB.DBPROPVAL_IC_UPPER:
                case ODB.DBPROPVAL_IC_LOWER:
                case ODB.DBPROPVAL_IC_MIXED:
                    identifierCase = IdentifierCase.Insensitive;
                    break;

                case ODB.DBPROPVAL_IC_SENSITIVE:
                    identifierCase = IdentifierCase.Sensitive;
                    break;
                }
            }
            row[columnName] = identifierCase;

        }
开发者ID:uQr,项目名称:referencesource,代码行数:21,代码来源:OleDbMetaDataFactory.cs

示例6: GetDataSourceInformationTable

        private DataTable GetDataSourceInformationTable(OleDbConnection connection, OleDbConnectionInternal internalConnection){

            // verify that the data source information table is in the data set
            DataTable dataSourceInformationTable = CollectionDataSet.Tables[DbMetaDataCollectionNames.DataSourceInformation];
            if (dataSourceInformationTable == null){
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.DataSourceInformation);
            }

            // copy the table filtering out any rows that don't apply to tho current version of the prrovider
            dataSourceInformationTable = CloneAndFilterCollection(DbMetaDataCollectionNames.DataSourceInformation, null);

            // after filtering there better be just one row
            if (dataSourceInformationTable.Rows.Count != 1){
                throw ADP.IncorrectNumberOfDataSourceInformationRows();
            }
            DataRow dataSourceInformation = dataSourceInformationTable.Rows[0];

            // update the identifier separator
            string catalogSeparatorPattern = internalConnection.GetLiteralInfo(ODB.DBLITERAL_CATALOG_SEPARATOR);
            string schemaSeparatorPattern = internalConnection.GetLiteralInfo(ODB.DBLITERAL_SCHEMA_SEPARATOR);

            if (catalogSeparatorPattern != null) {
                StringBuilder compositeSeparatorPattern = new StringBuilder();
                StringBuilder patternEscaped = new StringBuilder();
                ADP.EscapeSpecialCharacters(catalogSeparatorPattern,patternEscaped);
                compositeSeparatorPattern.Append(patternEscaped.ToString());
                if ((schemaSeparatorPattern != null) && (schemaSeparatorPattern != catalogSeparatorPattern)) {
                    compositeSeparatorPattern.Append("|");
                    patternEscaped.Length = 0;
                    ADP.EscapeSpecialCharacters(schemaSeparatorPattern,patternEscaped);
                    compositeSeparatorPattern.Append(patternEscaped.ToString());
                }
                    dataSourceInformation[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = compositeSeparatorPattern.ToString();
            }
            else if (schemaSeparatorPattern != null){
                StringBuilder patternEscaped = new StringBuilder();
                ADP.EscapeSpecialCharacters(schemaSeparatorPattern, patternEscaped);
                dataSourceInformation[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = patternEscaped.ToString();;
            }

            // update the DataSourceProductName
            object property;
            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo,ODB.DBPROP_DBMSNAME);
            if (property != null) {
                dataSourceInformation[DbMetaDataColumnNames.DataSourceProductName] = (string) property;
            }

            // update the server version strings
            dataSourceInformation[DbMetaDataColumnNames.DataSourceProductVersion] = ServerVersion;
            dataSourceInformation[DbMetaDataColumnNames.DataSourceProductVersionNormalized] = ServerVersionNormalized;


                // values that are the same for all OLE DB Providers. See SQLBU 308529
                dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerFormat] =  "?";
                dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerPattern] =  "\\?";
                dataSourceInformation[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;


            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo,ODB.DBPROP_GROUPBY);
            GroupByBehavior groupByBehavior = GroupByBehavior.Unknown;
            if (property != null) {
                switch ((int)property) {

                    case ODB.DBPROPVAL_GB_CONTAINS_SELECT:
                        groupByBehavior = GroupByBehavior.MustContainAll;
                        break;

                    case ODB.DBPROPVAL_GB_EQUALS_SELECT:
                        groupByBehavior = GroupByBehavior.ExactMatch;
                        break;

                    case ODB.DBPROPVAL_GB_NO_RELATION:
                        groupByBehavior = GroupByBehavior.Unrelated;
                        break;

                    case ODB.DBPROPVAL_GB_NOT_SUPPORTED:
                        groupByBehavior = GroupByBehavior.NotSupported;
                        break;
                }
            }
            dataSourceInformation[DbMetaDataColumnNames.GroupByBehavior] = groupByBehavior;

            SetIdentifierCase(DbMetaDataColumnNames.IdentifierCase,ODB.DBPROP_IDENTIFIERCASE,dataSourceInformation, connection);
            SetIdentifierCase(DbMetaDataColumnNames.QuotedIdentifierCase,ODB.DBPROP_QUOTEDIDENTIFIERCASE,dataSourceInformation, connection);

            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo,ODB.DBPROP_ORDERBYCOLUNSINSELECT);
            if (property != null) {
                dataSourceInformation[DbMetaDataColumnNames.OrderByColumnsInSelect] = (bool) property;
            }

            DataTable infoLiterals = internalConnection.BuildInfoLiterals();
            if (infoLiterals != null){
                DataRow[] tableNameRow = infoLiterals.Select("Literal = " + ODB.DBLITERAL_TABLE_NAME.ToString(CultureInfo.InvariantCulture));
                if (tableNameRow != null) {
                    object invalidCharsObject = tableNameRow[0]["InvalidChars"];
                    if (invalidCharsObject.GetType() == typeof(string)) {
                        string invalidChars = (string)invalidCharsObject;
                        object invalidStartingCharsObject = tableNameRow[0]["InvalidStartingChars"];
                        string invalidStartingChars;
                        if (invalidStartingCharsObject.GetType() == typeof(string)) {
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:OleDbMetaDataFactory.cs

示例7: GetSqlSupport

 internal int GetSqlSupport(OleDbConnection connection)
 {
     int num = this._sqlSupport;
     if (!this._hasSqlSupport)
     {
         object dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0x6d);
         if (dataSourcePropertyValue is int)
         {
             num = (int) dataSourcePropertyValue;
         }
         this._sqlSupport = num;
         this._hasSqlSupport = true;
     }
     return num;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:OleDbConnectionString.cs

示例8: GetSupportMultipleResults

 internal bool GetSupportMultipleResults(OleDbConnection connection)
 {
     bool flag = this._supportMultipleResults;
     if (!this._hasSupportMultipleResults)
     {
         object dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0xc4);
         if (dataSourcePropertyValue is int)
         {
             flag = 0 != ((int) dataSourcePropertyValue);
         }
         this._supportMultipleResults = flag;
         this._hasSupportMultipleResults = true;
     }
     return flag;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:OleDbConnectionString.cs


注:本文中的System.Data.OleDb.OleDbConnection.GetDataSourcePropertyValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。