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


C# OleDbDataReader.GetFieldType方法代码示例

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


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

示例1: GetDataTypes

        public static IDataType[] GetDataTypes(OleDbDataReader reader)
        {
            List<IDataType> types = new List<IDataType>();
            for (int i = 0; i < reader.FieldCount; i++)
            {
                if (reader.GetFieldType(i) == typeof(string))
                {
                    types.Add(new VarChar(reader.GetName(i), 1000));
                }
                else
                {
                    types.Add(new Number(reader.GetName(i)));
                }
            }

            return types.ToArray();
        }
开发者ID:azanium,项目名称:iShamelaV1-iOS,代码行数:17,代码来源:DbJet.cs

示例2: StoreColumnTypes

        public void StoreColumnTypes(OleDbDataReader Reader)
        {
            ColumnDataTypes = new DataType[Reader.FieldCount];

            for (int i = 0; i < ColumnDataTypes.Length; i++)
            {
                Type T = Reader.GetFieldType(i);

                if (T == Type.GetType("System.String"))
                {
                    ColumnDataTypes[i] = DataType.TypeString;
                }
                else if (T == Type.GetType("System.DateTime"))
                {
                    ColumnDataTypes[i] = DataType.TypeDate;
                }
                else
                {
                    ColumnDataTypes[i] = DataType.TypeInt;
                }
            }
        }
开发者ID:bathla18,项目名称:Web-log-analyser-cross-platform,代码行数:22,代码来源:QueryListView.cs

示例3: DisplayReader

        // Display the result set recursively expanding chapterDepth deep
        public void DisplayReader(OleDbDataReader myDataReader, ref uint count, uint alignment, int chapterDepth)
        {
            try
            {
                // compute alignment
                StringBuilder indent = new StringBuilder((int) alignment);
                indent.Append(' ', (int) alignment);

                while (myDataReader.Read())
                {
                    // add alignment
                    StringBuilder row = new StringBuilder(indent.ToString());

                    // for all columns
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        // null columns
                        if (myDataReader.IsDBNull(i))
                        {
                            row.Append("NULL;");
                        }
                        else
                        {

                            //vector columns
                            object[] myArray = myDataReader.GetValue(i) as object[];
                            if (myArray != null)
                            {
                                DisplayValue(myArray, row);
                            }
                            else
                            {
                                //check for chapter columns from "group on" queries
                                if (myDataReader.GetFieldType(i).ToString() != "System.Data.IDataReader")
                                {
                                    //regular columns are displayed here
                                    row.Append(myDataReader.GetValue(i));
                                }
                                else
                                {
                                    //for a chapter column type just display the colum name
                                    row.Append(myDataReader.GetName(i));
                                }
                            }
                            row.Append(';');
                        }
                    }
                    if (chapterDepth >= 0)
                    {
                        this.ScrubberGUIInst.DebugPrint(row.ToString());
                        count++;
                    }
                    // for each chapter column
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        if (myDataReader.GetFieldType(i).ToString() == "System.Data.IDataReader")
                        {
                            OleDbDataReader Reader = myDataReader.GetValue(i) as OleDbDataReader;
                            DisplayReader(Reader, ref count, alignment + 8, chapterDepth - 1);
                        }
                    }
                }
            }
            finally
            {
                myDataReader.Close();
                myDataReader.Dispose();
            }
        }
开发者ID:solbirn,项目名称:Scrubber,代码行数:70,代码来源:WindowsSearchCleaner.cs

示例4: DisplayReader

        // Display the result set recursively expanding chapterDepth deep
        static void DisplayReader(OleDbDataReader myDataReader, ref uint count, uint alignment, int chapterDepth)
        {
            try
            {
                // compute alignment
                StringBuilder indent = new StringBuilder((int)alignment);
                indent.Append(' ', (int)alignment);

                while (myDataReader.Read())
                {
                    // add alignment
                    StringBuilder row = new StringBuilder(indent.ToString());

                    // for all columns
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        // null columns
                        if (myDataReader.IsDBNull(i))
                        {
                            row.Append("NULL\t");
                        }
                        else
                        {
                            //vector columns
                            object[] myArray = myDataReader.GetValue(i) as object[];
                            if (myArray != null)
                            {
                                DisplayValue(myArray, row);
                            }
                            else
                            {
                                //check for chapter columns from "group on" queries
                                if (myDataReader.GetFieldType(i).ToString() != "System.Data.IDataReader")
                                {
                                    //regular columns are displayed here
                                    //If (OptPath == false) and colName is System.ItemPathDisplay
                                    //We want to skip Display of this Column
                                    if (!(OptPath == false && myDataReader.GetName(i) == "System.ItemPathDisplay"))
                                        row.Append(myDataReader.GetValue(i));
                                }
                                else
                                {
                                    //for a chapter column type just display the colum name
                                    row.Append(myDataReader.GetName(i));
                                }
                            }
                            row.Append('\t');
                        }
                    }
                    if (chapterDepth >= 0)
                    {
                        Console.WriteLine(row.ToString());
                        count++;
                    }
                    // for each chapter column
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        if (myDataReader.GetFieldType(i).ToString() == "System.Data.IDataReader")
                        {
                            OleDbDataReader Reader = myDataReader.GetValue(i) as OleDbDataReader;
                            DisplayReader(Reader, ref count, alignment + 8, chapterDepth - 1);
                        }
                    }
                }
            }
            finally
            {
                myDataReader.Close();
                myDataReader.Dispose();
            }
        }
开发者ID:Grynn,项目名称:locate,代码行数:72,代码来源:Program.cs

示例5: GetValue

        private int GetValue(OleDbDataReader oData)
        {
            int intValue;
            string strFieldType;

            strFieldType = Convert.ToString(oData.GetFieldType(0));

            switch (strFieldType)
            {
                case "System.Int16":
                    intValue = Convert.ToInt32(oData.GetInt16(0));
                    break;

                case "System.Int32":
                    intValue = oData.GetInt32(0);
                    break;

                case "System.Double":
                    intValue = Convert.ToInt32(oData.GetDouble(0));
                    break;

                default:
                    intValue = oData.GetInt32(0);
                    break;

            }

            return intValue;
        }
开发者ID:smorrisey,项目名称:afpreportscli,代码行数:29,代码来源:dataupload.cs


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