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


C# DataView.ToTable方法代码示例

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


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

示例1: DatasetQCLevels

            public static List<QualityControlLevelType> DatasetQCLevels(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN = "QualityControlLevelID";
                string TABLENAME = "QualityControlLevels";
                List<QualityControlLevelType> list = new List<QualityControlLevelType>();
                try
                {
                    DataView view = new DataView(ds.DataValues);
                    view.RowFilter = valuesWhereClause;

                    DataTable ids = view.ToTable(TABLENAME, true, new string[] {COLUMN});

                    foreach (DataRow r in ids.Rows)
                    {
                        try
                        {
                           // Object aId = r[COLUMN];

                            if (r[COLUMN] == DBNull.Value)
                            {
                                continue;
                            }
                            int? aId = Convert.ToInt32(r[COLUMN]);
                            // edit here
                            ValuesDataSet.QualityControlLevelsRow qcLevels =
                                ds.QualityControlLevels.FindByQualityControlLevelID((int) aId.Value);
                            if (qcLevels != null)
                            {
                                QualityControlLevelType t = new QualityControlLevelType();
                                t.qualityControlLevelID = qcLevels.QualityControlLevelID;
                                t.qualityControlLevelIDSpecified = true;
                                t.qualityControlLevelCode = qcLevels.QualityControlLevelCode;
                                t.definition = qcLevels.Definition;
                                t.explanation = qcLevels.Explanation;

                                list.Add(t);
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error("Error generating a QualityControlLevels " + r.ToString() + e.Message);
                        }
                    }
                    return list;
                }

                catch (Exception e)
                {
                    log.Error("Error generating a QualityControlLevels " + e.Message);
                    // non fatal exceptions
                    return null;
                }
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:60,代码来源:ODValues_v1_1.cs

示例2: datasetOffsetTypes

            /// <summary>
            /// Method to generate a list of offset (from OD OffsetTypes table) in a ValuesDataSet
            /// This is done as a separate method since Values can could contain other VariableValue Types
            ///
            /// </summary>
            /// <param name="ds">ValuesDataSet with the values used in the timeSeries</param>
            /// <returns></returns>
            public static List<OffsetType> datasetOffsetTypes(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN = "OffsetTypeID";
                string TABLENAME = "offsetTypes";
                List<OffsetType> list = new List<OffsetType>();
                try
                {
                    DataView view = new DataView(ds.DataValues);
                    view.RowFilter = valuesWhereClause;

                    DataTable ids = view.ToTable(TABLENAME, true, new string[] {COLUMN});

                    foreach (DataRow r in ids.Rows)
                    {
                        try
                        {
                            //Object aId = r[COLUMN];

                            if (r[COLUMN] == DBNull.Value)
                            {
                                continue;
                            }
                int? aId = Convert.ToInt32(r[COLUMN]);
                            // edit here
                            ValuesDataSet.OffsetTypesRow offset = ds.OffsetTypes.FindByOffsetTypeID((int) aId.Value);
                            if (offset != null)
                            {
                                OffsetType t = new OffsetType();
                                t.offsetTypeID = offset.OffsetTypeID;
                                t.offsetTypeIDSpecified = true;

                                t.offsetTypeCode = t.offsetTypeID.ToString();

                                if (!String.IsNullOrEmpty(offset.OffsetDescription))
                                    t.offsetDescription = offset.OffsetDescription;

                                ValuesDataSet.UnitsRow offUnit = ds.Units.FindByUnitsID(offset.OffsetUnitsID);
                                string offUnitsCode;

                                string offUnitsName = null;
                                string offUnitsAbbreviation = null;
                                if (!String.IsNullOrEmpty(offUnit.UnitsAbbreviation))
                                    offUnitsAbbreviation = offUnit.UnitsAbbreviation;
                                if (!String.IsNullOrEmpty(offUnit.UnitsName)) offUnitsName = offUnit.UnitsName;
                                if (offUnit != null)
                                    t.unit = CuahsiBuilder.CreateUnitsElement(
                                        offUnit.UnitsType, offUnit.UnitsID.ToString(), offUnitsAbbreviation,
                                        offUnitsName);

                                list.Add(t);
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error("Error generating a offsetTypes " + r.ToString() + e.Message);
                        }
                    }
                    return list;
                }

                catch (Exception e)
                {
                    log.Error("Error generating a offsetTypes " + e.Message);
                    // non fatal exceptions
                    return null;
                }
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:81,代码来源:ODValues_v1_1.cs

示例3: datasetSamples

            public static List<SampleType> datasetSamples(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN = "SampleID";
                string TABLENAME = "Sample";
                List<SampleType> list = new List<SampleType>();
                try
                {
                    DataView view = new DataView(ds.DataValues);
                    view.RowFilter = valuesWhereClause;

                    DataTable ids = view.ToTable(TABLENAME, true, new string[] {COLUMN});

                    foreach (DataRow r in ids.Rows)
                    {
                        try
                        {
                            //Object aId = r[COLUMN];

                            if (r[COLUMN] == DBNull.Value)
                            {
                                continue;
                            }
                            int? aId = Convert.ToInt32(r[COLUMN]);
                            // edit here
                            ValuesDataSet.SamplesRow samples = ds.Samples.FindBySampleID((int) aId.Value);
                            if (samples != null)
                            {
                                SampleType t = new SampleType();
                                t.sampleID = samples.SampleID;
                                t.sampleIDSpecified = true;
                                t.labSampleCode = samples.LabSampleCode;
                                if (!String.IsNullOrEmpty(samples.SampleType)) t.sampleType = samples.SampleType;

                                LabMethodType labMethod = new LabMethodType();

                                labMethod.labMethodName = samples.LabMethodName;
                                labMethod.labName = samples.LabName;
                                labMethod.labOrganization = samples.LabOrganization;
                                labMethod.labCode = samples.LabSampleCode;
                                labMethod.labMethodDescription = samples.LabMethodDescription;
                                if (!samples.IsLabMethodLinkNull())
                                {
                                    labMethod.labMethodLink = samples.LabMethodLink;
                                }

                                t.labMethod = labMethod;

                                list.Add(t);
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error("Error generating a Samples " + r.ToString() + e.Message);
                        }
                    }
                    return list;
                }

                catch (Exception e)
                {
                    log.Error("Error generating a Samples " + e.Message);
                    // non fatal exceptions
                    return null;
                }
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:72,代码来源:ODValues_v1_1.cs

示例4: datasetCensorCodes

            /// <summary>
            ///  generate a list of CensorCodes 
            /// This is done as a separate method since Values can could contain other VariableValue Types
            ///
            /// </summary>
            /// <param name="ds">ValuesDataSet with the values used in the timeSeries</param>
            /// <param name="valuesWhereClause"></param>
            /// <returns></returns>
            public static IEnumerable<CensorCodeType> datasetCensorCodes(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN = "CensorCode";
                string TABLENAME = "CensorCodeCV";
                DataView view = new DataView(ds.DataValues);
                view.RowFilter = valuesWhereClause;

                DataTable ids = view.ToTable(TABLENAME, true, new string[] { COLUMN });
                foreach (DataRow r in ids.Rows)
                {
                          //Object aId = r[COLUMN];

                        if (r[COLUMN] == DBNull.Value)
                        {
                            continue;
                        }
                        string aId = (string)r[COLUMN];
                        // edit here
                        ValuesDataSet.CensorCodeCVRow codeCvRow = ds.CensorCodeCV.FindByTerm(aId);
                        if (codeCvRow != null)
                        {
                            CensorCodeType t = new CensorCodeType();
                            t.censorCode = codeCvRow.Term;

                            if (!codeCvRow.IsDefinitionNull() && !String.IsNullOrEmpty(codeCvRow.Definition))
                            {
                                t.censorCodeDescription = codeCvRow.Definition;
                            }

                            yield return t;
                        }
                   }
                //foreach (ValuesDataSet.CensorCodeCVRow r in ds.CensorCodeCV.Rows)
                //{
                //    CensorCodeType t = new CensorCodeType();
                //    t.censorCode = r.Term;

                //    if (!r.IsDefinitionNull() && !String.IsNullOrEmpty(r.Definition))
                //    {
                //          t.censorCodeDescription = r.Definition;
                //    }

                //   yield return t;
                //}
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:60,代码来源:ODValues_v1_1.cs

示例5: datasetSources

            /// <summary>
            /// Method to generate a list of Sources in a ValuesDataSet
            /// This is done as a separate method since Values can could contain other VariableValue Types
            ///
            /// </summary>
            /// <param name="ds">ValuesDataSet with the values used in the timeSeries</param>
            /// <returns></returns>
            public static List<SourceType> datasetSources(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN = "SourceID";
                string TABLENAME = "sources";
                List<SourceType> list = new List<SourceType>();
                try
                {
                    DataView view = new DataView(ds.DataValues);
                    view.RowFilter = valuesWhereClause;

                    DataTable ids = view.ToTable(TABLENAME, true, new string[] {COLUMN});

                    foreach (DataRow r in ids.Rows)
                    {
                        try
                        {
                            //Object aId = r[COLUMN];

                            if (r[COLUMN] == DBNull.Value)
                            {
                                continue;
                            }
                            int? aId = Convert.ToInt32(r[COLUMN]);
                            ValuesDataSet.SourcesRow source = ds.Sources.FindBySourceID((int) aId.Value);
                            if (source != null)
                            {
                                SourceType t = new SourceType();
                                t.sourceID = source.SourceID;
                                t.sourceIDSpecified = true;

                                t.sourceCode = source.SourceID.ToString();

                                if (!String.IsNullOrEmpty(source.Organization)) t.organization = source.Organization;
                                t.sourceDescription = source.SourceDescription;
                                if (!source.IsSourceLinkNull())
                                {
                                    t.sourceLink = new string[] {source.SourceLink};
                                }

                                // create a contact
                                // only one for now
                                ContactInformationType contact = new ContactInformationType();
                                contact.typeOfContact = "main";
                                if (!String.IsNullOrEmpty(source.ContactName)) contact.contactName = source.ContactName;
                                if (!String.IsNullOrEmpty(source.Email))
                                {
                                    contact.email = new string[] {source.Email};
                                }
                                if (!String.IsNullOrEmpty(source.Phone))
                                {
                                    contact.phone = new string[] {source.Phone};
                                }
                                StringBuilder address = new StringBuilder();

                                if (!String.IsNullOrEmpty(source.Address))
                                    address.Append(source.Address + System.Environment.NewLine);
                                if (!String.IsNullOrEmpty(source.City)
                                    && !String.IsNullOrEmpty(source.State)
                                    && !String.IsNullOrEmpty(source.ZipCode))
                                    address.AppendFormat(",{0}, {1} {2}", source.City, source.State, source.ZipCode);

                                contact.address = new string[] {address.ToString()};
                                t.contactInformation = new ContactInformationType[] {contact};

                                if (!String.IsNullOrEmpty(source.Citation))
                                {
                                    t.citation = source.Citation;
                                }

                                if (source.MetadataID != 0 && source.ISOMetadataRow != null)
                                {
                                    MetaDataType m= new MetaDataType();
                                    m.topicCategory = source.ISOMetadataRow.TopicCategory;
                                    m.title = source.ISOMetadataRow.Title;
                                    [email protected] = source.ISOMetadataRow.Abstract;
                                    m.profileVersion = source.ISOMetadataRow.ProfileVersion;
                                    if (!source.ISOMetadataRow.IsMetadataLinkNull())
                                    {
                                        m.metadataLink = source.ISOMetadataRow.MetadataLink;

                                    }
                                    t.metadata = m;
                                }
                                list.Add(t);
                            }
                        }
//.........这里部分代码省略.........
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:101,代码来源:ODValues_v1_1.cs

示例6: datasetMethods

            /// <summary>
            /// Method to generate a list of qualifiers in a ValuesDataSet
            /// This is done as a separate method since Values can could contain other VariableValue Types
            ///
            /// </summary>
            /// <param name="ds">ValuesDataSet with the values used in the timeSeries</param>
            /// <param name="valuesWhereClause"></param>
            /// <returns></returns>
            public static List<MethodType> datasetMethods(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN = "MethodID";
                string TABLENAME = "methods";
                List<MethodType> list = new List<MethodType>();
                try
                {
                    DataView view = new DataView(ds.DataValues);
                    view.RowFilter = valuesWhereClause;

                    DataTable ids = view.ToTable(TABLENAME, true, new string[] {COLUMN});

                    foreach (DataRow r in ids.Rows)
                    {
                        try
                        {
                            //Object aId = r[COLUMN];

                            if (r[COLUMN] == DBNull.Value)
                            {
                                continue;
                            }
                            int? aId = Convert.ToInt32(r[COLUMN]);
                            // edit here
                            ValuesDataSet.MethodsRow method = ds.Methods.FindByMethodID((int) aId.Value);
                            if (method != null)
                            {
                                MethodType t = new MethodType();
                                t.methodID = method.MethodID;
                                t.methodIDSpecified = true;

                                t.methodCode = method.MethodID.ToString();

                                if (!String.IsNullOrEmpty(method.MethodDescription))
                                    t.methodDescription = method.MethodDescription;
                                if (!method.IsMethodLinkNull()) t.methodLink = method.MethodLink;
                                list.Add(t);
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error("Error generating a qualifier " + r.ToString() + e.Message);
                        }
                    }
                    return list;
                }

                catch (Exception e)
                {
                    log.Error("Error generating a qualifiers " + e.Message);
                    // non fatal exceptions
                    return null;
                }
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:69,代码来源:ODValues_v1_1.cs

示例7: datasetQualifiers

            /// <summary>
            /// Method to generate a list of qualifiers in a ValuesDataSet
            /// This is done as a separate method since Values can could contain other VariableValue Types
            ///
            /// </summary>
            /// <param name="ds">ValuesDataSet with the values used in the timeSeries</param>
            /// <param name="valuesWhereClause"></param>
            /// <returns></returns>
            public static List<QualifierType> datasetQualifiers(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */

                List<QualifierType> qualifiers = new List<QualifierType>();
                try
                {
                    DataView qview = new DataView(ds.DataValues);
                    qview.RowFilter = valuesWhereClause;

                    DataTable qids = qview.ToTable("Qualifiers", true, new string[] {"QualifierID"});

                    foreach (DataRow q in qids.Rows)
                    {
                        try
                        {

                            if (q["QualifierID"]==DBNull.Value)
                            {
                                continue;
                            }
                            int? qid = Convert.ToInt32(q["QualifierID"]);
                            ValuesDataSet.QualifiersRow qual = ds.Qualifiers.FindByQualifierID((int) qid.Value);
                            if (qual != null)
                            {
                                QualifierType qt = new QualifierType();
                                qt.qualifierID = qual.QualifierID;
                                if (!qual.IsQualifierCodeNull())
                                {
                                    qt.qualifierCode = qual.QualifierCode;
                                } else
                                {
                                    qt.qualifierCode = qual.QualifierID.ToString();
                                }
                                if (!String.IsNullOrEmpty(qual.QualifierDescription))
                                    qt.qualifierDescription = qual.QualifierDescription;
                                qualifiers.Add(qt);
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error("Error generating a qualifier " + q.ToString() + e.Message);
                        }
                    }
                    return qualifiers;
                }

                catch (Exception e)
                {
                    log.Error("Error generating a qualifiers " + e.Message);
                    // non fatal exceptions
                    return null;
                }
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:68,代码来源:ODValues_v1_1.cs

示例8: ToTableTest_DataValidity

        public void ToTableTest_DataValidity()
        {
            DataTable table = new DataTable();
            table.Columns.Add("col1", typeof(int));
            table.Columns.Add("col2", typeof(int));
            table.Columns.Add("col3", typeof(int));

            for (int i = 0; i < 5; ++i)
            {
                table.Rows.Add(new object[] { i, i + 1, i + 2 });
                table.Rows.Add(new object[] { i, i + 1, i + 2 });
            }

            table.AcceptChanges();
            DataView view = new DataView(table);
            try
            {
                DataTable newTable = view.ToTable(false, null);
            }
            catch (ArgumentNullException e)
            {
                // Never premise English.
                //Assert.Equal ("'columnNames' argument cannot be null." + Environment.NewLine + 
                //		"Parameter name: columnNames", e.Message, "#1");
            }
            DataTable newTable1 = view.ToTable(false, new string[] { });
            Assert.Equal(10, newTable1.Rows.Count);

            newTable1 = view.ToTable(true, new string[] { });
            Assert.Equal(3, newTable1.Columns.Count);
            Assert.Equal(5, newTable1.Rows.Count);

            table.Rows.Add(new object[] { 1, 100, 100 });

            newTable1 = view.ToTable(true, new string[] { });
            Assert.Equal(3, newTable1.Columns.Count);
            Assert.Equal(6, newTable1.Rows.Count);

            newTable1 = view.ToTable(true, new string[] { "col1" });
            Assert.Equal(1, newTable1.Columns.Count);
            Assert.Equal(5, newTable1.Rows.Count);

            newTable1 = view.ToTable(true, new string[] { "col2", "col3" });
            Assert.Equal(2, newTable1.Columns.Count);
            Assert.Equal(6, newTable1.Rows.Count);

            for (int i = 0; i < newTable1.Rows.Count; ++i)
                Assert.Equal(DataRowState.Added, newTable1.Rows[i].RowState);

            view = new DataView(table, "col1>1", "col1 asc, col2 desc", DataViewRowState.Added);
            Assert.Equal(0, view.Count);

            newTable1 = view.ToTable(false, new string[] { "col1", "col3" });
            Assert.Equal(0, newTable1.Rows.Count);

            table.Rows.Add(new object[] { 10, 1, 1 });
            table.Rows.Add(new object[] { 10, 1, 3 });
            table.Rows.Add(new object[] { 10, 1, 2 });

            Assert.Equal(3, view.Count);
            view.Sort = "col1 asc, col2 asc, col3 desc";
            newTable1 = view.ToTable(true, new string[] { "col1", "col3" });
            Assert.Equal(3, newTable1.Rows.Count);
            Assert.Equal(3, newTable1.Rows[0][1]);
            Assert.Equal(2, newTable1.Rows[1][1]);
            Assert.Equal(1, newTable1.Rows[2][1]);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:67,代码来源:DataViewTest2.cs

示例9: ToTable_SimpleTest

        public void ToTable_SimpleTest()
        {
            var ds = new DataSet();
            ds.Tables.Add("table");
            ds.Tables[0].Columns.Add("col1", typeof(int));
            ds.Tables[0].Columns.Add("col2", typeof(int), "sum(col1)");
            ds.Tables[0].Columns.Add("col3", typeof(int));
            ds.Tables[0].Columns[2].AutoIncrement = true;

            ds.Tables[0].Rows.Add(new object[] { 1 });
            ds.Tables[0].Rows.Add(new object[] { 2 });

            ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns[0] };

            DataView view = new DataView(ds.Tables[0]);
            DataTable table = view.ToTable();

            // The rule seems to be : Copy any col property that doesent
            // involve/depend on other columns..
            // Constraints and PrimaryKey info not copied over
            Assert.Equal(0, table.PrimaryKey.Length);
            Assert.Equal(0, table.Constraints.Count);
            // AllowDBNull state is maintained by ms.net
            Assert.False(table.Columns[0].AllowDBNull);
            Assert.True(table.Columns[2].AllowDBNull);
            // Expression is not copied over by ms.net
            Assert.Equal("", table.Columns[1].Expression);
            // AutoIncrement state is maintained by ms.net
            Assert.True(table.Columns[2].AutoIncrement);

            Assert.False(ds.Tables[0] == table);

            Assert.Equal(ds.Tables[0].TableName, table.TableName);
            Assert.Equal(ds.Tables[0].Columns.Count, table.Columns.Count);
            Assert.Equal(ds.Tables[0].Rows.Count, table.Rows.Count);

            for (int i = 0; i < table.Columns.Count; ++i)
            {
                Assert.Equal(ds.Tables[0].Columns[i].ColumnName, table.Columns[i].ColumnName);
                Assert.Equal(ds.Tables[0].Columns[i].DataType, table.Columns[i].DataType);
                for (int j = 0; j < table.Rows.Count; ++j)
                    Assert.Equal(ds.Tables[0].Rows[j][i], table.Rows[j][i]);
            }

            DataTable table1 = view.ToTable("newtable");
            Assert.Equal("newtable", table1.TableName);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:47,代码来源:DataViewTest2.cs

示例10: getVariable

            public static VariableInfoType[] getVariable(VariableParam vParam, VariablesDataset ds)
            {
                List<VariableInfoType> vars = new List<VariableInfoType>();
                if (vParam != null)
                {
                    /* need to use a data view, so the we can set a filter that does not effect the whole dataset
                   DataView has a ToTable method that is uses to create a new DS, and fill
                     * a new VariablesDataset. Typed Datasets are useful ;)
                     */

                    DataView view = new DataView();
                    view.Table = ds.Tables["Variables"];

                    if (vParam.IsId)
                    {
                        view.RowFilter = "VariableID = " + vParam.Code + " ";
                    }
                    else
                    {
                        view.RowFilter = "VariableCode = '" + vParam.Code + "' ";
                        // list of possible options. Allowing any will break the query (aka QualityControlLevelID, etc)
                        String[] options = {"samplemedium", "datatype", "valuetype"};

                        foreach (string opt in options)
                        {
                            if (vParam.options.ContainsKey(opt))
                            {
                                if (!String.IsNullOrEmpty(vParam.options[opt]))
                                {
                                    String rowFilter = view.RowFilter + " AND "
                                                       + opt + "='" + vParam.options[opt] + "'";
                                    view.RowFilter = rowFilter;
                                }
                            }
                        }
                    }

                    DataTable v = view.ToTable();

                    if (v.Rows.Count > 0)
                    {
                        VariablesDataset vtemp = new VariablesDataset();

                        vtemp.Variables.Merge(v);

                        foreach (VariablesDataset.VariablesRow row in vtemp.Variables.Rows)
                        {
                            VariableInfoType result = rowToVariableInfoType(row,
                                                                            ds
                                );
                            vars.Add(result);
                        }

                        return vars.ToArray();
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
开发者ID:jirikadlec2,项目名称:hydrodata,代码行数:65,代码来源:ODvariables_v1_1.cs


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