當前位置: 首頁>>代碼示例>>C#>>正文


C# DataTable.AddColumns方法代碼示例

本文整理匯總了C#中System.Data.DataTable.AddColumns方法的典型用法代碼示例。如果您正苦於以下問題:C# DataTable.AddColumns方法的具體用法?C# DataTable.AddColumns怎麽用?C# DataTable.AddColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Data.DataTable的用法示例。


在下文中一共展示了DataTable.AddColumns方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetParameters

 public void SetParameters(params object[][] rows)
 {
     _tables.Remove("PARAMETERS");
     var table = new DataTable("PARAMETERS");
     table.AddColumns("PROCEDURE_SCHEMA", "PROCEDURE_NAME", "PARAMETER_NAME");
     table.AddRows(rows);
     _tables.Add("PARAMETERS", table);
 }
開發者ID:rposbo,項目名稱:Simple.Data,代碼行數:8,代碼來源:MockSchemaProvider.cs

示例2: SetPrimaryKeys

 public void SetPrimaryKeys(params object[][] rows)
 {
     var table = new DataTable("PRIMARY_KEYS");
     table.AddColumns("TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME");
     table.Columns.Add("ORDINAL_POSITION", typeof (int));
     table.AddRows(rows);
     _tables.Add("PRIMARY_KEYS", table);
 }
開發者ID:rposbo,項目名稱:Simple.Data,代碼行數:8,代碼來源:MockSchemaProvider.cs

示例3: SetTables

 public void SetTables(params object[][] rows)
 {
     _tables.Remove("TABLES");
     var table = new DataTable("TABLES");
     table.AddColumns("TABLE_SCHEMA", "TABLE_NAME", "TABLE_TYPE");
     table.AddRows(rows);
     _tables.Add("TABLES", table);
 }
開發者ID:rposbo,項目名稱:Simple.Data,代碼行數:8,代碼來源:MockSchemaProvider.cs

示例4: SetColumns

 public void SetColumns(params object[][] rows)
  {
      _tables.Remove("COLUMNS");
      var table = new DataTable("COLUMNS");
      table.AddColumns("TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME", "IS_IDENTITY", "DATA_TYPE", "CHARACTER_MAXIMUM_LENGTH");
      table.AddRows(AddIdentityDefault(rows));
      _tables.Add("COLUMNS", table);
  }
開發者ID:rposbo,項目名稱:Simple.Data,代碼行數:8,代碼來源:MockSchemaProvider.cs

示例5: SetForeignKeys

 public void SetForeignKeys(params object[][] rows)
 {
     var table = new DataTable("FOREIGN_KEYS");
     table.AddColumns("CONSTRAINT_NAME", "TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME",
                      "UNIQUE_TABLE_SCHEMA", "UNIQUE_TABLE_NAME", "UNIQUE_COLUMN_NAME");
     table.Columns.Add("ORDINAL_POSITION", typeof(int));
     table.AddRows(rows);
     _tables.Add("FOREIGN_KEYS", table);
 }
開發者ID:rposbo,項目名稱:Simple.Data,代碼行數:9,代碼來源:MockSchemaProvider.cs

示例6: MainTable

        public static DataTable MainTable()
        {
            var table = new DataTable("QOAMcorners");

            table.AddColumns("Test Corner", "Another Corner");

            table.AddRow(new[] { "123-123", "777-888" });
            table.AddRow(new[] { "456-456", "" });

            return table;
        }
開發者ID:spapaseit,項目名稱:qoam,代碼行數:11,代碼來源:CornerStubs.cs

示例7: AuthorsTable

        public static DataTable AuthorsTable()
        {
            var table = new DataTable("Links");

            table.AddColumns("eissn", "url");

            table.AddRow(new[] { "1687-8140", "http://ade.sagepub.com/submission" });
            table.AddRow(new[] { "2073-4395", "http://www.mdpi.com/journal/agronomy/submission" });
            table.AddRow(new[] { "2372-0484", "http://www.aimspress.com/journal/Materials/submission" });
            table.AddRow(new[] { "1687-7675", "http://www.hindawi.com/journals/aess/submission" });

            return table;
        }
開發者ID:spapaseit,項目名稱:qoam,代碼行數:13,代碼來源:SubmissionLinkImportStubs.cs

示例8: LicenseTable

        public static DataTable LicenseTable(string licenseName)
        {
            var table = new DataTable(licenseName);

            table.AddColumns("eISSN", "text");

            table.AddRow(new[] { "0219-3094", "Discount of 100% on publication fee. Please contact your library for more information." });
            table.AddRow(new[] { "0219-3116", "Some random text" });
            table.AddRow(new[] { "0814-6039", "I'm Batman" });
            table.AddRow(new[] { "0942-0940", "No, really." });

            return table;
        }
開發者ID:spapaseit,項目名稱:qoam,代碼行數:13,代碼來源:ImportFileStubs.cs

示例9: AuthorsTable

        public static DataTable AuthorsTable()
        {
            var table = new DataTable("Authors");

            table.AddColumns("eissn", "Author email address", "Author name");

            table.AddRow(new[] { "1687-8140", "[email protected]", "A. Caenen" });
            table.AddRow(new[] { "2073-4395", "[email protected]", "Jeroen De Waele"});
            table.AddRow(new[] { "2372-0484", "[email protected]", "Dolores Esquivel"});
            table.AddRow(new[] { "1687-7675", "[email protected]", "E. Van Ranst"});
            table.AddRow(new[] { "1234-7675", "[email protected],[email protected];[email protected]", "K. Test"});

            return table;
        }
開發者ID:spapaseit,項目名稱:qoam,代碼行數:14,代碼來源:InvitationStubs.cs

示例10: UniversitiesTable

        public static DataTable UniversitiesTable()
        {
            var table = new DataTable("Universities");

            table.AddColumns("Domains", "Tabs");

            table.AddRow(new[] { "ru.nl", "Sage" });
            table.AddRow(new[] { "uu.nl", "Springer" });
            table.AddRow(new[] { "uva.nl", "Springer, Sage" });
            table.AddRow(new[] { "rug.nl", "Springer,Sage" });
            table.AddRow(new[] { "ugent.be", "Springer; Sage" });
            table.AddRow(new[] { "upc.cat", "Springer;Sage" });

            return table;
        }
開發者ID:spapaseit,項目名稱:qoam,代碼行數:15,代碼來源:ImportFileStubs.cs

示例11: CreateTable

        private DataTable CreateTable(int columnId, List<NormalDistributionValueItem> items)
        {
            string[] targetValues = StaticStorage.DataSet.AsEnumerable().Select(m => m[StaticStorage.TargetColum].ToString().Format()).Where(m => m != "").ToArray();
            string[] targetDistinctValues = targetValues.Distinct().ToArray();

            string predictorColumn = StaticStorage.DataSet.Columns[columnId].ColumnName;
            string[] predictorValues = StaticStorage.DataSet.AsEnumerable().Select(m => m[predictorColumn].ToString().Format()).Where(m => m != "").ToArray();
            string[] predictorDistinctValues = predictorValues.Distinct().ToArray();

            DataTable result = new DataTable($"{StaticStorage.DataSet.Columns[columnId].ColumnName} - {StaticStorage.TargetColum}");
            result.Columns.Add(predictorColumn.Format());
            result.AddColumns(targetDistinctValues);

            foreach (string predictorDistinctValue in predictorDistinctValues)
            {
                DataRow row = result.NewRow();
                foreach (string targetDistinctValue in targetDistinctValues)
                {
                    row[predictorColumn.Format()] = predictorDistinctValue;

                    NormalDistributionValueItem item = items.First(m => m.TargetValue.Equals(targetDistinctValue));

            /*                    double exponent =
                         Math.Exp(-(Math.Pow(double.Parse(predictorDistinctValue) - item.Mean, 2)/(2*Math.Pow(item.Std, 2))));
                    double probability = (1/(Math.Sqrt(2*Math.PI)*item.Std))*exponent;*/

                    double zscore = (double.Parse(predictorDistinctValue) - item.Mean) / item.Std;
                    double exponent = -(zscore * zscore) / 2;
                    double probability = (1 / Math.Sqrt(2 * Math.PI)) * Math.Exp(exponent);

                    row[targetDistinctValue] = Math.Round(probability, 6);
                }
                result.Rows.Add(row);
            }

            return result;
        }
開發者ID:Denn93,項目名稱:DataMiningAssignments,代碼行數:37,代碼來源:OneRAlgorithm.cs


注:本文中的System.Data.DataTable.AddColumns方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。