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


C# IDataTable类代码示例

本文整理汇总了C#中IDataTable的典型用法代码示例。如果您正苦于以下问题:C# IDataTable类的具体用法?C# IDataTable怎么用?C# IDataTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: FormTableInfo

 public FormTableInfo(TreeNode node)
 {
     this.node = node;
     this.conn = node.Parent.Parent.Tag as UserConn;
     this.table = node.Tag as IDataTable;
     InitializeComponent();
 }
开发者ID:g992com,项目名称:esb,代码行数:7,代码来源:FormTableInfo.cs

示例2: FormTable_Load

        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormTable_Load(object sender, EventArgs e)
        {
            table = BindingNode.Tag as IDataTable;
            frmTableInfo = new FormTableInfo(BindingNode);

            LoadData();
        }
开发者ID:g992com,项目名称:esb,代码行数:12,代码来源:FormTable.cs

示例3: GetCCT

 public static double GetCCT(IDataTable<DataRow> data, string a, string b, WaitObject flag)
 {
     int count = data.RowCount;
     double xyS = 0;
     double xS = 0;
     double yS = 0;
     double x2S = 0;
     double y2S = 0;
     double tempx = 0;
     double tempy = 0;
     DataRow temprow;
     flag.Flags = new int[1];
     flag.Max = count;
     for (int i = 0; i < count; i++)
     {
         temprow = data[i];
         tempx = temprow[a].ConvertToDouble();
         tempy = temprow[b].ConvertToDouble();
         xyS += tempx * tempy;
         xS += tempx;
         yS += tempy;
         x2S += tempx * tempx;
         y2S += tempy * tempy;
         flag.Flags[0]++;
     }
     return (xyS * count - xS * yS) / (Math.Pow((x2S * count - xS * xS), 0.5) * Math.Pow((y2S * count - yS * yS), 0.5));
 }
开发者ID:supergfox,项目名称:SPC,代码行数:27,代码来源:Relations.cs

示例4: Clone

        /// <summary>克隆</summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public IDataRelation Clone(IDataTable table)
        {
            var field = base.MemberwiseClone() as XRelation;
            field.Table = table;

            return field;
        }
开发者ID:tommybiteme,项目名称:X,代码行数:10,代码来源:XRelation.cs

示例5: WatcherSetupDialog

        public WatcherSetupDialog(string db_path, string table_oid, IDataTable table_to_edit, bool editing)
        {
            pathToDb = db_path;
            tbl_OID = table_oid;
            tableToEdit = table_to_edit;
            InitializeComponent();

            /* Functionality buttons */
            m_saveButton.Click += m_saveButton_Click;
            m_goToNamespaces.Click += m_goToNamespaces_Click;
            m_recordBox.Unchecked += m_recordBox_Unchecked;
            m_recordBox.Checked += m_recordBox_Checked;
            m_cancelButton.Click += m_cancelButton_Click;
            m_clearButton.Click += m_clearButton_Click;

            /* Interface smoothing actions */
            m_sourcePathBox.TextChanged += m_sourcePathBox_TextChanged;

            /* Help dialog buttons */
            h_sourceHelp.Click += h_sourceHelp_Click;
            h_recordPath.Click += h_recordPath_Click;
            h_advanceMode.Click += h_advanceMode_Click;
            h_namespaces.Click += h_namespaces_Click;
            form_Init(editing, pathToDb);
        }
开发者ID:jharriman,项目名称:CoolSignDb-Server-Client,代码行数:25,代码来源:WatcherSetupDialog.xaml.cs

示例6: LmGress

        public static Tuple<Image, string, double[]> LmGress(IDataTable<DataRow> data, int width, int height, string targetcolumn, string[] sourcecolumns)
        {
            AppDomain domain = AppDomain.CreateDomain(Guid.NewGuid().ToString());
            string name = Guid.NewGuid().ToString();
            var root = new DirectoryInfo(System.Windows.Forms.Application.StartupPath + "\\..\\Temp");
            if (!root.Exists)
                root.Create();
            string fullimagepath = root.FullName + "\\" + name + ".png";
            string fulltextpath = root.FullName + "\\" + name + ".txt";
            byte[] buffer = null;
            string result = "";
            double[] coe = null;
            try
            {
                int rcount = data.RowCount;
                int ccount = sourcecolumns.Length + 1;
                int i;
                List<double[]> sourcedata = new List<double[]>();
                Dictionary<string, double[]> doubledata = new Dictionary<string, double[]>();
                Dictionary<string, string[]> stringdata = new Dictionary<string, string[]>();
                double[] temp = new double[rcount];
                    for (i = 0; i < rcount; i++)
                        temp[i] = data[i, targetcolumn].ConvertToDouble();
                    doubledata.Add(targetcolumn, temp);

                foreach (var sourcecolumn in sourcecolumns)
                {
                    temp = new double[rcount];
                    for (i = 0; i < rcount; i++)
                        temp[i] = data[i, sourcecolumn].ConvertToDouble();
                    doubledata.Add(sourcecolumn, temp);
                }
                coe = (domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(Lmregress).FullName) as Lmregress).BaseStart(root.FullName, name, width, height, targetcolumn, sourcecolumns, doubledata);
                using (FileStream fs = new FileStream(fullimagepath, FileMode.Open))
                {
                    buffer = new byte[fs.Length];
                    fs.Read(buffer, 0, buffer.Length);
                }
                using (StreamReader sr = new StreamReader(fulltextpath, Encoding.Default))
                {
                    result = sr.ReadToEnd();
                    int start = result.IndexOf("Residuals:");
                    if (start >= 0)
                        result = result.Substring(start);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                AppDomain.Unload(domain);
                File.Delete(fullimagepath);
                File.Delete(fulltextpath);
            }
            return new Tuple<Image, string, double[]>(Image.FromStream(new MemoryStream(buffer)), result, coe);
        }
开发者ID:supergfox,项目名称:SPC,代码行数:58,代码来源:Access.cs

示例7: SurveyStore

 public SurveyStore(
     IDataTable<SurveyRow> surveyTable,
     IDataTable<QuestionRow> questionTable,
     ISurveyAnswerContainerFactory surveyAnswerContainerFactory)
 {
   Trace.WriteLine(string.Format("Called constructor in SurveyStore"), "UNITY");
   this.surveyTable = surveyTable;
   this.questionTable = questionTable;
   this.surveyAnswerContainerFactory = surveyAnswerContainerFactory;
 }
开发者ID:shahmitulv,项目名称:MelSamples,代码行数:10,代码来源:SurveyStore.cs

示例8: DoSelectTableCommand

        private void DoSelectTableCommand(IDataTable inParameter)
        {
            if (SelectedTable != null)
                SelectedTable.IsSelected = false;

            inParameter.IsSelected = true;
            SelectedTable = inParameter;

            RefreshDataPreview();
        }
开发者ID:jdbrock,项目名称:curvature,代码行数:10,代码来源:MainViewModel.cs

示例9: Schmidt

        public static Tuple<List<string>, List<double>, DataTable> Schmidt(IDataTable<DataRow> data, List<string> columns)
        {
            int columncount = columns.Count;
            int rowcount = data.RowCount;
            double[][] vectors = new double[columncount][];
            int i, j;
            for (i = 0; i < columncount; i++)
            {
                vectors[i] = new double[rowcount];
                for (j = 0; j < rowcount; j++)
                {
                    vectors[i][j] = data[j,columns[i]].ConvertToDouble();
                }

            }
            int[] maxid;
            double[,] report;
            MPPO.DataProcess.Schmidt.Start(vectors, columncount, rowcount, out maxid, out report);
            var result = new List<string>();
            var percents = new List<double>();
            var resultdetail = new DataTable();
            foreach (var column in columns)
            {
                resultdetail.Columns.Add(column, typeof(double));
            }
            for (i = 0; i < columncount; i++)
            {
                var temprow = resultdetail.NewRow();
                for (j = 0; j < columncount; j++)
                {
                    temprow[j] = report[i, j];
                }
                resultdetail.Rows.Add(temprow);
            }
            for (i = 0; i < columncount; i++)
            {
                var columnname = columns[maxid[i]];
                result.Add(columnname);
                resultdetail.Columns[columnname].SetOrdinal(i);
            }
            double total = 0;
            double percent = 0;
            for (j = 0; j < columncount; j++)
            {
                total += resultdetail.Rows[j][j].ConvertToDouble();
            }
            for (i = 0; i < columncount; i++)
            {
                percent += (resultdetail.Rows[i][i].ConvertToDouble() * 100 / total);
                percents.Add(percent);
            }
            percents[columncount - 1] = 100;
            return new Tuple<List<string>, List<double>, DataTable>(result, percents, resultdetail);
        }
开发者ID:noelhx,项目名称:MultiParamProcessOptimization,代码行数:54,代码来源:DataProcessOperation.cs

示例10: ExportToExcel

        public static void ExportToExcel(IDataTable<DataRow> data, string filename,Protocol.Structure.WaitObject wt)
        {
            if (data == null)
                return;
            var excel = new ApplicationClass();
            if (excel == null)
                throw new Exception("Excel无法启动");
            int rowNum = data.RowCount;
            string[] columns = data.GetColumnsList();
            int columnNum = columns.Length;
            wt.Flags = new int[1];
            wt.Max = rowNum * columnNum;
            int rowIndex = 1;
            int columnIndex = 0;
            var book = excel.Application.Workbooks.Add(true);
            try
            {
                foreach (var column in columns)
                {
                    columnIndex++;
                    excel.Cells[rowIndex, columnIndex] = column;
                    if (data.GetColumnType(column) == typeof(string))
                        excel.get_Range(excel.Cells[rowIndex + 1, columnIndex], excel.Cells[rowNum + 1, columnIndex]).NumberFormatLocal = "@";
                }
                for (int i = 0; i < rowNum; i++)
                {
                    rowIndex++;
                    columnIndex = 0;
                    for (int j = 0; j < columnNum; j++)
                    {
                        columnIndex++;
                        excel.Cells[rowIndex, columnIndex] = data[i,columns[j]];
                        wt.Flags[0]++;
                    }

                }
                excel.DisplayAlerts = false;
                excel.AlertBeforeOverwriting = false;
                book.SaveCopyAs(filename);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                book.Close(false);
                book = null;
                excel.Quit();
                excel = null;
            }
        }
开发者ID:noelhx,项目名称:MultiParamProcessOptimization,代码行数:52,代码来源:BasicExcelOperation.cs

示例11: Entropy

 public static List<Tuple<string, double>> Entropy(IDataTable<DataRow> data, List<string> columns, Protocol.Structure.WaitObject wt)
 {
     var result = new List<Tuple<string, double>>();
     var columnsarray = columns.ToArray();
     var re = MPPO.DataProcess.Entropy.GetEntropy(data, columnsarray,wt);
     int count = re.Length;
     for (int i = 0; i < count; i++)
     {
         result.Add(new Tuple<string, double>(columns[i], re[i]));
     }
     result.Sort(new Comparison<Tuple<string, double>>((a1, a2) => { return a1.Item2.CompareTo(a2.Item2); }));
     return result;
 }
开发者ID:noelhx,项目名称:MultiParamProcessOptimization,代码行数:13,代码来源:DataProcessOperation.cs

示例12: GetCCTs

 public static double[] GetCCTs(IDataTable<DataRow> data, string target, string[] f,WaitObject flag)
 {
     int count = data.RowCount;
     int length = f.Length;
     double[] fs = new double[length];
     double[] xfs = new double[length];
     double[] f2s = new double[length];
     double[] result = new double[length];
     double xS = 0;
     double x2S = 0;
     int j = 0;
     double tempx = 0;
     double tempy = 0;
     DataRow temprow;
     flag.Flags = new int[1];
     flag.Max = count * length;
     for (int i = 0; i < count; i++)
     {
         temprow = data[i];
         tempx = temprow[target].ConvertToDouble();
         xS += tempx;
         x2S += tempx * tempx;
         for(j=0;j<length;j++)
         {
             tempy = temprow[f[j]].ConvertToDouble();
             xfs[j] += tempx * tempy;
             fs[j] += tempy;
             f2s[j] += tempy * tempy;
             flag.Flags[0]++;
         }
     }
     double down;
     for (j = 0; j < length; j++)
     {
         down = (Math.Pow((x2S * count - xS * xS), 0.5) * Math.Pow((f2s[j] * count - fs[j] * fs[j]), 0.5));
         if (down != 0)
             result[j] = (xfs[j] * count - xS * fs[j]) / down;
         else if (x2S == 0)
             result[j] = 1;
         else
             result[j] = 0;
     }
     return result;
 }
开发者ID:supergfox,项目名称:SPC,代码行数:44,代码来源:Relations.cs

示例13: DrawContourPlot

 public static Image DrawContourPlot(IDataTable<DataRow> data, string xs, string ys, string zs,int width,int height,double[] levels,bool drawline)
 {
     int rowcount = data.RowCount;
     double[] x = new double[rowcount];
     double[] y = new double[rowcount];
     double[] z = new double[rowcount];
     DataRow row;
     for (int i = 0; i < rowcount; i++)
     {
         row = data[i];
         x[i] = row[xs].ConvertToDouble();
         y[i] = row[ys].ConvertToDouble();
         z[i] = row[zs].ConvertToDouble();
     }
     AppDomain domain = AppDomain.CreateDomain(Guid.NewGuid().ToString());
     string name = Guid.NewGuid().ToString();
     var root = new DirectoryInfo(System.Windows.Forms.Application.StartupPath+"\\..\\Temp");
     if (!root.Exists)
         root.Create();
     string fullpath = root.FullName + "\\" + name+".png";
     byte[] buffer;
     try
     {
         (domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(Graphics).FullName) as Graphics).DrawContourPlot(root.FullName, name, x, y, z,width,height,levels,drawline);
         using (FileStream fs = new FileStream(fullpath, FileMode.Open))
         {
             buffer = new byte[fs.Length];
             fs.Read(buffer, 0, buffer.Length);
         }
     }
     catch(Exception ex)
     {
         throw ex;
     }
     finally
     {
         AppDomain.Unload(domain);
         File.Delete(fullpath);
     }
     return Image.FromStream(new MemoryStream(buffer));
 }
开发者ID:supergfox,项目名称:SPC,代码行数:41,代码来源:Access.cs

示例14: ReadFromTable

        /// <summary>
        /// 根据 optionNode 中的描述信息,读取 table 中的数据组装为对象列表并返回。
        /// 如果 optionNode 中指定要加载更多的子/引用对象,则会递归调用自己实现聚合加载。
        /// </summary>
        /// <param name="list">The list.</param>
        /// <param name="table">The table.</param>
        /// <param name="optionNode">The option node.</param>
        private void ReadFromTable(EntityList list, IDataTable table, LinkedListNode<LoadOptionItem> optionNode)
        {
            var option = optionNode.Value;
            AggregateEntityLoaderHelper.ReadFromTable(list, table, (entity, subTable) =>
            {
                EntityList listResult = null;

                //是否还有后继需要加载的对象?如果是,则递归调用自己进行子对象的加载。
                var nextNode = optionNode.Next;
                if (nextNode != null)
                {
                    listResult = nextNode.Value.OwnerRepository.NewList();
                    this.ReadFromTable(listResult, subTable, nextNode);
                }
                else
                {
                    listResult = option.PropertyEntityRepository.NewList();
                    AggregateEntityLoaderHelper.ReadFromTable(listResult, subTable, null);
                }

                //是否需要排序?
                if (listResult.Count > 1 && option.OrderBy != null)
                {
                    listResult = option.PropertyEntityRepository.NewListOrderBy(listResult, option.OrderBy);
                }

                //当前对象是加载类型的子对象还是引用的外键
                if (option.LoadType == AggregateLoadType.Children)
                {
                    listResult.SetParentEntity(entity);
                    entity.LoadProperty(option.PropertyMeta.ManagedProperty, listResult);
                }
                else
                {
                    if (listResult.Count > 0)
                    {
                        option.SetReferenceEntity(entity, listResult[0]);
                    }
                }
            });
        }
开发者ID:569550384,项目名称:Rafy,代码行数:48,代码来源:AggregateEntityLoader.cs

示例15: VerifyDataTable

        private void VerifyDataTable(IDataTable table)
        {
            Assert.AreEqual(12, table.Columns.Count, "Columns Count");
            Assert.AreEqual(10, table.Rows.Count, "Rows Count");

            var cols = table.Columns;

            Assert.AreEqual("Id", cols[0].Name);
            Assert.AreEqual("Sku", cols[1].Name);
            Assert.AreEqual("Name", cols[2].Name);
            Assert.AreEqual("Description", cols[3].Name);
            Assert.AreEqual("Bool", cols[4].Name);
            Assert.AreEqual("Date", cols[5].Name);
            Assert.AreEqual("OADate", cols[6].Name);
            Assert.AreEqual("UnixDate", cols[7].Name);
            Assert.AreEqual("Int", cols[8].Name);
            Assert.AreEqual("Double", cols[9].Name);
            Assert.AreEqual("Guid", cols[10].Name);
            Assert.AreEqual("IntList", cols[11].Name);

            var rows = table.Rows;

            rows[3]["Sku"].ShouldEqual("SKU 4");
            rows[1]["Name"].ShouldEqual("äöü");
            rows[7]["Description"].ShouldEqual("Description 8");
            rows[0]["Bool"].Convert<bool>().ShouldBeTrue();
            rows[5]["Bool"].Convert<bool>().ShouldBeTrue();
            rows[6]["Bool"].Convert<bool>().ShouldBeFalse();
            rows[3]["Double"].Convert<double>().ShouldEqual(9999.765);
            rows[0]["OADate"].Convert<DateTime>().ShouldEqual(DateTime.FromOADate(rows[0]["OADate"].Convert<double>()));
            rows[3]["Guid"].Convert<Guid>().ShouldEqual(Guid.Parse("77866957-eec3-4b35-950f-10d1699ac46d"));

            rows[0]["IntList"].Convert<List<int>>().ShouldSequenceEqual(new List<int> { 1, 2, 3, 4 });
            rows[1]["IntList"].Convert<List<short>>().ShouldSequenceEqual(new List<short> { 1, 2, 3, 4 });
            rows[5]["IntList"].Convert<List<double>>().ShouldSequenceEqual(new List<double> { 1, 2, 3, 4 });
        }
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:36,代码来源:DataReaderTests.cs


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