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


C# DataColumn.Dispose方法代码示例

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


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

示例1: nseCompanyCodes

        public static void nseCompanyCodes()
        {
            StreamReader sr = new StreamReader(@"C:\\Documents and Settings\\Amey\\Desktop\\EQUITY_L.csv");
            DataTable nsedata = new DataTable();
            DataColumn companyName = new DataColumn("CompanyName");
            nsedata.Columns.Add(companyName);
            DataColumn nsecode = new DataColumn("NSE Code");
            nsedata.Columns.Add(nsecode);
            DataRow row;
            string[] values = null;
            sr.ReadLine();
            while (!sr.EndOfStream)
            {
                values = sr.ReadLine().Split(',');
                row = nsedata.NewRow();
                row[companyName] = values[1];
                row[nsecode] = values[0];
                nsedata.Rows.Add(row);

            }
            CommonFunctions.Write(nsedata, "nsecompanies.txt");
            sr.Close();
            nsedata.Dispose();
            companyName.Dispose();
            nsecode.Dispose();
        }
开发者ID:androidea86,项目名称:StockQuote,代码行数:26,代码来源:NSECompanyCode.cs

示例2: ConverDataTableToString

 //Convert DataTbale All column in String Column
 public DataTable ConverDataTableToString(DataTable dataTable)
 {
     DataTable tempDataTable = new DataTable();
     foreach (DataColumn columnName in dataTable.Columns)
     {
         DataColumn tempColumn = new DataColumn();
         tempColumn.ColumnName = columnName.ColumnName;
         tempColumn.DataType = System.Type.GetType("System.String");
         tempColumn.AutoIncrement = false;
         tempColumn.Caption = columnName.Caption;
         tempColumn.ReadOnly = false;
         tempColumn.Unique = false;
         tempDataTable.Columns.Add(tempColumn);
         tempColumn.Dispose();
     }
     foreach (DataRow readRow in dataTable.Rows)
     {
         DataRow tempdataRow = tempDataTable.NewRow();
         foreach (DataColumn readColumn in dataTable.Columns)
         {
             tempdataRow[readColumn.ColumnName] = readRow[readColumn.ColumnName].ToString();
         }
         tempDataTable.Rows.Add(tempdataRow);
     }
     return tempDataTable;
 }
开发者ID:shuvo009,项目名称:ProcestaPetunia,代码行数:27,代码来源:NecessaryFunction.cs

示例3: scrapBSECompaniesCode

        public static void scrapBSECompaniesCode()
        {
            try
            {
                DataTable bsedata=new DataTable();
                DataColumn companyName = new DataColumn("CompanyName");
                bsedata.Columns.Add(companyName);
                DataColumn bsecode = new DataColumn("BSE Code");
                bsedata.Columns.Add(bsecode);
                DataRow row;
                string url = ConfigurationManager.AppSettings["BSECompanyCodeURL"].ToString();
                HtmlWeb webpage = new HtmlWeb();

                HtmlAgilityPack.HtmlDocument document = webpage.Load(url);
                HtmlNode node = document.DocumentNode.SelectSingleNode("//div[@id='content']");

                string[] temp;
                foreach (HtmlNode link in node.SelectNodes("//a[@href]"))
                {
                    if (Regex.IsMatch(link.InnerText, "BSE code:"))
                    {
                        temp = Regex.Split(link.InnerText, "BSE code:");
                        row=bsedata.NewRow();
                        row[companyName] = temp[0].Remove(temp[0].Length-1).Trim();
                        row[bsecode] = temp[1].Replace(')',' ').Trim();
                        bsedata.Rows.Add(row);

                    }
                }
                CommonFunctions.Write(bsedata, "bsecompanies.txt");
                companyName.Dispose();
                bsecode.Dispose();
                bsedata.Dispose();

            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:androidea86,项目名称:StockQuote,代码行数:41,代码来源:BSECompanyCode.cs

示例4: makeHeader

        private void makeHeader(DataTable lsTable, string[] lsColumns)
        {
            try
            {
                DataColumn lsCol;

                if (lsTable.Columns.Count == 0)
                    lsTable.Columns.Clear();

                foreach (string s in lsColumns)
                {
                    lsCol = new DataColumn();
                    lsCol.DataType = System.Type.GetType("System.String");
                    lsCol.ColumnName = s;
                    lsTable.Columns.Add(lsCol);
                    lsCol.Dispose();
                }

                return;
            }
            catch (Exception ex)
            {
                showErrorMessage(ex);
            }
        }
开发者ID:ChiHsuChen,项目名称:myTaskScheduler,代码行数:25,代码来源:frmMain.cs

示例5: CreateColForTable

 private void CreateColForTable()
 {
     _DTServerData = new DataTable();
     DataColumn dc = new DataColumn("ValueName");
     dc.DataType = System.Type.GetType("System.String");
     _DTServerData.Columns.Add(dc);
     dc = new DataColumn("Value");
     dc.DataType = System.Type.GetType("System.String");
     _DTServerData.Columns.Add(dc);
     dc.Dispose();
 }
开发者ID:dfwdino,项目名称:Closed-ServerInfo,代码行数:11,代码来源:ProgramHelp.cs

示例6: MakeTPTable

        private void MakeTPTable()
        {
            DataColumn myColumn = new DataColumn();
            DataTable dtbl = new DataTable("history");
            dtbl.Locale = CultureInfo.CurrentCulture;

            myColumn.DataType = System.Type.GetType("System.String");
            myColumn.ColumnName = "time";
            dtbl.Columns.Add(myColumn);

            myColumn = new DataColumn();
            myColumn.DataType = System.Type.GetType("System.String");
            myColumn.ColumnName = "name";
            dtbl.Columns.Add(myColumn);

            myColumn = new DataColumn();
            myColumn.DataType = System.Type.GetType("System.String");
            myColumn.ColumnName = "slurl";
            dtbl.Columns.Add(myColumn);

            dtbl.PrimaryKey = new DataColumn[] { dtbl.Columns["time"] };

            tp = dtbl;

            myColumn.Dispose();
            dtbl.Dispose();
        }
开发者ID:NullProjects,项目名称:METAbolt,代码行数:27,代码来源:METAboltInstance.cs

示例7: MakeGiverDataTable

        //private DataTable MakeDataTable()
        //{
        //    DataColumn myColumn = new DataColumn();
        //    DataTable dtbl = new DataTable("list");
        //    myColumn.DataType = System.Type.GetType("System.String");
        //    myColumn.ColumnName = "mute_name";
        //    dtbl.Columns.Add(myColumn);
        //    myColumn = new DataColumn();
        //    myColumn.DataType = System.Type.GetType("System.String");
        //    myColumn.ColumnName = "uuid";
        //    dtbl.Columns.Add(myColumn);
        //    //mutelist.Columns.Add(myColumn);
        //    //dtbl.PrimaryKey = new DataColumn[] { dtbl.Columns["uuid"] };
        //    myColumn.Dispose();
        //    return dtbl;
        //}
        private static DataTable MakeGiverDataTable()
        {
            DataTable dtbl = new DataTable("list");
            dtbl.Locale = CultureInfo.CurrentCulture;
            DataColumn myColumn = new DataColumn();

            myColumn.DataType = System.Type.GetType("System.String");
            myColumn.ColumnName = "Command";
            dtbl.Columns.Add(myColumn);

            //client.Inventory.GiveItem(iitem.UUID, iitem.Name, iitem.AssetType, avid, false);

            DataColumn myColumn1 = new DataColumn();
            myColumn1.DataType = System.Type.GetType("System.String");
            myColumn1.ColumnName = "UUID";
            dtbl.Columns.Add(myColumn1);

            DataColumn myColumn2 = new DataColumn();
            myColumn2 = new DataColumn();
            myColumn2.DataType = System.Type.GetType("System.String");
            myColumn2.ColumnName = "Name";
            dtbl.Columns.Add(myColumn2);

            DataColumn myColumn3 = new DataColumn();
            myColumn3.DataType = System.Type.GetType("System.String");
            myColumn3.ColumnName = "AssetType";
            dtbl.Columns.Add(myColumn3);

            DataColumn[] keys = new DataColumn[1];
            keys[0] = myColumn;

            dtbl.PrimaryKey = keys;

            myColumn.Dispose();
            myColumn1.Dispose();
            myColumn2.Dispose();
            myColumn3.Dispose();

            return dtbl;
        }
开发者ID:NullProjects,项目名称:METAbolt,代码行数:56,代码来源:METAboltInstance.cs


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