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


C# DataTable.ImportRow方法代码示例

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


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

示例1: ProcessarAtendimentosHIS

        /// <summary>
        /// Obtem todos atendimentos a partir do Ultimo Registro.
        /// </summary>
         /// <param name="m_iQtdeRegistros">Quantidade de Registro</param>
        /// <returns></returns>
        public void ProcessarAtendimentosHIS(Int32 m_iQtdeRegistros)
        {
            string m_sUltimoRegistro;
            DataSet DsDados = new DataSet(); 

            ServiceHBD.WSLerAtendimentosSoapClient DadosOrigens = new WSLerAtendimentosSoapClient();  

            //Obtem o Ultimo Registro
            m_sUltimoRegistro = DadosOrigens.RetornarUltimoRegistro(mUnidade);   

            //Obtem as Informações 
            DsDados = DadosOrigens.RetornarAtendimentos(m_sUltimoRegistro, m_iQtdeRegistros);    
                  
            //Gravar no DWSATELITE
            for (int i = 0; i < DsDados.Tables[0].Rows.Count; i++)
            {
                DataRow Dr0 = DsDados.Tables[0].Rows[i];

                DataSet Ds = new DataSet();
                DataTable Dt = new DataTable(DsDados.Tables[0].TableName);

                Dt = DsDados.Tables[0].Clone();

                Dt.ImportRow(Dr0);
                
                Ds.Tables.Add(Dt);

                DadosOrigens.GravarAtendimento(mUnidade, Ds);

                //m_oDataSet = Ds;

                //Salvar();
            }

        }
开发者ID:Workker,项目名称:ETLRedeDor,代码行数:40,代码来源:HBD_Atendimentos.cs

示例2: ReorderDeptRow

        private static DataTable ReorderDeptRow(DataTable dtReturn, int deptID, DataTable dtDept, int align)
        {
            //获取部门的子部门
            DataRow[] drSubDept = dtDept.Select("SuperDeptID = " + deptID);

            //遍历所有子部门
            for (int i = 0; i < drSubDept.Length; i++)
            {
                //通过对齐位置,来控制该部门前空格数
                string alignPosition = string.Empty;
                for (int j = 0; j < align; j++)
                {
                    alignPosition += "&nbsp;&nbsp;";
                }
                //获取子部门数据
                DataRow drSubDeptTemp = (DataRow)drSubDept[i];
                //获取子部门ID
                int subDeptID = (int)drSubDeptTemp["ID"];
                drSubDeptTemp["DeptName"] = alignPosition  + drSubDeptTemp["DeptName"].ToString();
                //导入子部门
                dtReturn.ImportRow(drSubDeptTemp);
                //生成子部门的子部门信息
                dtReturn = ReorderDeptRow(dtReturn, subDeptID, dtDept, align + 1);
            }
            return dtReturn;
        }
开发者ID:kosmos-zhang,项目名称:erp-aspnet,代码行数:26,代码来源:PerformanceTemplateEmpBus.cs

示例3: ImportRowToDataTable

 public static void ImportRowToDataTable(ref DataTable dt, DataRow[] rows)
 {
     foreach (DataRow r in rows)
     {
         dt.ImportRow(r);
     }
 }
开发者ID:anthanhcong,项目名称:atc-demand-instruction-form,代码行数:7,代码来源:Utils.cs

示例4: GetMenuItemBLL

 /// <summary>
 /// 菜单列表项
 /// </summary>
 /// <param name="menutb">level=0的一级菜单</param>
 /// <param name="subMenutb">level=1的二级菜单</param>
 /// <param name="parentMenutb">isparent=1的具有二级菜单的一级菜单</param>
 public static void GetMenuItemBLL(out DataTable menutb,out DataTable subMenutb,out DataTable parentMenutb)
 {
     DataTable dt = Front_DataCollectorDAL.GetMenuItemDAL();
     menutb = dt.Clone();//存放level=0的1层菜单
     subMenutb = dt.Clone();//存放level=1的子菜单
     parentMenutb = dt.Clone();//存放isparent=1的1层菜单
     if (dt!=null && dt.Rows.Count>0)
     {
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             DataRow dr = dt.Rows[i];
             if (dr["menu_level"].ToString()=="0")
             {
                 menutb.ImportRow(dr);
                 if (dr["menu_isparent"].ToString()=="1")
                 {
                     parentMenutb.ImportRow(dr);
                 }
             }
             else if(dr["menu_level"].ToString()=="1")
             {
                 subMenutb.ImportRow(dr);
             }
         }
     }
 }
开发者ID:z303346878,项目名称:gyecweb_repo,代码行数:32,代码来源:Front_DataHandlerBLL.cs

示例5: GetModelHtmlValue

    public DataSet GetModelHtmlValue(string ChId, string Id)
    {
        int MyChId = int.Parse(ChId);
        ChannelModel = MyChId <= 0 ? null : ChannelBll.GetChannel(MyChId);
        MInfoModel = BInfoModel.GetModel(ChannelModel.ModelType);
        DataTable dt=new DataTable();
        DataRow dr = BInfoOper.GetInfo(MInfoModel.TableName, int.Parse(Id));
        dt = dr.Table.Copy();
        dt.Clear();
        dt.ImportRow(dr);
        dt.TableName = "DrInfo";

        DataSet ds = new DataSet();
        try
        {
            ds.Tables.Add(BModelField.GetList(ChannelModel.ModelType).Copy());
            ds.Tables.Add(dt);
        }
        catch(Exception ex)
        {
            Response.Write(ex);
        }

        return ds;
    }
开发者ID:suizhikuo,项目名称:KYCMS,代码行数:25,代码来源:UpdateInfo.aspx.cs

示例6: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        #region Check Login
        CheckStateAdminSession();
        #endregion Check Login

        #region Initialize Values and Form Execution

        DataTable table = (DataTable)Session["StudentList"];
        studentList = table.Clone();

        int startIndex = Convert.ToInt32(CareerCruisingWeb.CCLib.Common.Strings.GetFormString("Start"));
        int endIndex = Convert.ToInt32(CareerCruisingWeb.CCLib.Common.Strings.GetFormString("End"));

        // select occupations from above list that correspond to cluster code passed
        for (int counter = startIndex; counter <= endIndex; counter++)
        {
            studentList.ImportRow(table.Rows[counter]);
        }

        if (studentList.Rows.Count > 0)
            rptMassPrintPLPSignOff.DataBind();

        #endregion Initialize Values and Form Execution

        #region Properties For The State Base Class
        HasTopHeader = false;
        #endregion Properties For The State Base Class
    }
开发者ID:nehawadhwa,项目名称:ccweb,代码行数:29,代码来源:MassPrintPLPSignOff.aspx.cs

示例7: ReadUserInfo

    public DataTable ReadUserInfo(string str)
    {
        if (bll.GetCookie() == null)
        {
            return null;
        }
        else
        {
            int UserId = bll.GetCookie().UserID;

            DataTable dt = new DataTable();
            try
            {
                dr = bll.GetUserAllInfo(UserId);
                dt = dr.Table.Copy();
                dt.Clear();
                dt.ImportRow(dr);
            }
            catch (Exception ex)
            {
                Response.Write(ex);
            }
            return dt;
        }
    }
开发者ID:suizhikuo,项目名称:KYCMS,代码行数:25,代码来源:ReadUserInfo.aspx.cs

示例8: Upload

        public static void Upload(this System.Data.DataTable dt, string tableName)
        {

            string query = "SELECT * from " + tableName;


            using (SqlConnection conn = new SqlConnection(SqlConnStr))
            {
                using (SqlDataAdapter oda = new SqlDataAdapter())
                {
                    using (SqlCommandBuilder bu = new SqlCommandBuilder())
                    {
                        using (SqlBulkCopy bulkcopy = new SqlBulkCopy(conn))
                        {
                            oda.SelectCommand = new SqlCommand(query, conn);
                            bulkcopy.DestinationTableName = "dbo." + tableName;
                            DataTable dtsql = new DataTable();
                            oda.Fill(dtsql);
                            List<DataRow> lst_temp = dt.AsEnumerable().ToList();
                            foreach (DataRow row in lst_temp)
                            {
                                dtsql.ImportRow(row);
                            }
                            conn.Open();

                            bulkcopy.WriteToServer(dtsql);
                            conn.Close();
                        }
                    }
                }
            }

        }
开发者ID:Sho20,项目名称:In2S3D_v4,代码行数:33,代码来源:DbConn.cs

示例9: FlawForm

        public FlawForm(DataRow flaw, Dictionary<string, NMap.Model.Unit> currentUnitList)
        {
            InitializeComponent();

            // Initialize datatable struct
            _flawData = new DataTable();
            _flawData.Columns.Add("FlawID", typeof(string));
            _flawData.Columns.Add("FlawType", typeof(int));
            _flawData.Columns.Add("FlawClass", typeof(string));
            _flawData.Columns.Add("Area", typeof(string));
            _flawData.Columns.Add("CD", typeof(decimal));
            _flawData.Columns.Add("MD", typeof(decimal));
            _flawData.Columns.Add("Width", typeof(decimal));
            _flawData.Columns.Add("Length", typeof(decimal));

            _flawData.ImportRow(flaw);
            _drFlaw = _flawData.Rows[0];
            _currentCdConversion = currentUnitList["FlawMapCD"].Conversion;
            _currentMdConversion = currentUnitList["FlawMapMD"].Conversion;
            _currentUnitList = currentUnitList;
            _drFlaw["CD"] = Convert.ToDecimal(_drFlaw["CD"]) / _currentCdConversion;
            _drFlaw["MD"] = Convert.ToDecimal(_drFlaw["MD"]) / _currentMdConversion;
            DataHelper dh = new DataHelper();
            _imageList = dh.GetFlawImageFromDb(_drFlaw);
        }
开发者ID:CalvertYang,项目名称:NMap,代码行数:25,代码来源:FlawForm.cs

示例10: AppendData

        private static void AppendData(DataTable source, ref DataTable target)
        {
            if (target == null)
                target = source.Clone();

            foreach (DataRow row in source.Rows)
                target.ImportRow(row);
        }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:8,代码来源:GenericHierarchicalQueryExecutor.cs

示例11: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        #region Properties For The Base Class and Check Login
        LoginID = Request.QueryString["LoginID"];
        LoginInfo = CareerCruisingWeb.CCLib.Login.GetLoginInfo(LoginID);
        Redirect();
        PageTitle = TextCode(5672);
        Section = "connect";
        CSS = "connect";
        LeftBar = "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR VALIGN='TOP' BGCOLOR='#000000'><TD BACKGROUND='/media/connect/i_c_indigo_bar_bg.gif'><IMG SRC='/media/connect/i_c_connect_icon.gif' WIDTH='24' HEIGHT='23' BORDER='0' alt=''><IMG SRC='/media1/Connect/ClientBranding/Shared/h_network_" + NWBrandingNamePic + SuffixCode() + ".gif' WIDTH='141' HEIGHT='23' ALIGN='TOP' alt='" + NWBrandingShortName + "'>";
        ucHeader.strTitle = TextCode(5677);
        #endregion Properties For The Base Class and Check Login

        #region Get related careers
        string jobInfoTableName = "Jobinfo" + SuffixCountryLanguageCode(AbbreviatedCountryCode());
        string tblClusterCareer = "Clusters" + ConSysInfo["ConSysCountry"].ToString();
        strClusterID = Request.QueryString["cID"];
        if ((LoginID != "")&&(strClusterID!="")&&(ConSysID!=""))
        {
            dtClusterInfo = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable("select ClusterType,ClusterCode,ClusteName" + NonEngSuffixCode() + " from ClusterCodes where ClusterID=" + strClusterID);
            if (dtClusterInfo.Rows.Count > 0)
            {
                strSelect = dtClusterInfo.Rows[0]["ClusteName" + NonEngSuffixCode()].ToString();
                strClusterCode = dtClusterInfo.Rows[0]["ClusterCode"].ToString();
            }

            strSQL = "SELECT DISTINCT ji.OccNumber,ji.OccName,ji.OneDesc, ic." + ConSysInfo["ClusterType"].ToString() + " FROM " + jobInfoTableName + " as ji inner join " + tblClusterCareer + " as ic on ji.OccNumber=ic.OccNumber inner join Con_CareerCoaches as cc on ji.OccNumber=cc.OccNumber ";
            strSQL += " inner join Con_PartnerUsers cp on cp.PartnerUserID=cc.PartnerUserID ";
            strSQL += " where (cc.IsApproved=1) and cp.ConSysID="+ConSysID+" and cp.PartnerStatusID=4 ORDER by ji.OccName ";

            dtCareerClusters = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(strSQL);
            dtCareerSearchResults = new DataTable();
            dtCareerSearchResults = dtCareerClusters.Clone();

            // select occupations from above list that correspond to cluster code passed
            foreach (DataRow row in dtCareerClusters.Rows)
            {
                allClusterCodes = row[ConSysInfo["ClusterType"].ToString()].ToString().Split(',');

                foreach (string clusteCode in allClusterCodes)
                {
                    if (clusteCode == strClusterCode)
                    {
                        dtCareerSearchResults.ImportRow(row);
                        break;
                    }
                }
            }
            uc1.dtCoachClusterResults = dtCareerSearchResults;
            uc1.LoginID = LoginID;
            uc1.UserLanguage = UserLanguage;
            uc1.PageT = "Cluster";
            uc1.ConSysID = ConSysID;
        }

        #endregion
    }
开发者ID:nehawadhwa,项目名称:ccweb,代码行数:57,代码来源:CoachClusterResults.aspx.cs

示例12: Form7_Load

        private void Form7_Load(object sender, EventArgs e)
        {
            xmlFile = XmlReader.Create("Veiculo.xml", new XmlReaderSettings());
            DataSet ds = new DataSet();
            ds.ReadXml(xmlFile);
            dt = ds.Tables[0].Clone(); //Tabela recebe dados XML

            //Passando dados do DataSet para Tabela
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                dt.ImportRow(row);
            }

            view = dt.DefaultView; //View recebe dados da tabela
            VeiculoBindingSource.DataSource = view;
            this.reportViewer1.RefreshReport();

            #region Populando Filtro de Tipo de Veículo

            List<String> veiculos = new List<String>();

            //Carregando o xml dos Trechos
            XElement xmlVeiculos = XElement.Load("Veiculo.xml");

            //Populando a lista de cidade com o as cidadesA
            foreach (XElement x in xmlVeiculos.Elements())
            {
                veiculos.Add(x.Element("TipoVeiculo").Value);
            }

            foreach (string vei in veiculos)
            {
                this.checkBoxcomboBox_RelVeiculos.Items.Add(vei);
            }
            #endregion

            #region Populando Filtro de Cargas

            List<String> cargas = new List<String>();

            //Carregando o xml dos Trechos
            XElement xmlCargas = XElement.Load("Veiculo.xml");

            //Populando a lista de cidade com o as cidadesA
            foreach (XElement x in xmlCargas.Elements())
            {
                cargas.Add(x.Element("CargaMaxima").Value);
            }

            foreach (string car in cargas)
            {
                this.checkBoxComboBox2.Items.Add(car);
            }
            #endregion

        }
开发者ID:pedrosouzax,项目名称:Roteirizador,代码行数:56,代码来源:FormRelatVeic.cs

示例13: GetNewDataTable

    private DataTable GetNewDataTable(DataTable dt, string condition)
    {
        DataTable newdt = new DataTable();
        newdt = dt.Clone();
        DataRow[] dr = dt.Select(condition);
        for (int i = 0; i < dr.Length; i++)
            newdt.ImportRow((DataRow)dr[i]);

        return newdt;
    }
开发者ID:ichari,项目名称:ichari,代码行数:10,代码来源:LinkBonusScale.aspx.cs

示例14: SourceTableProvider

 public SourceTableProvider(TableLink sourceTableLink, RowLink[] sourceRows)
 {
   this.sourceTableLink = sourceTableLink;
   //this.table = sourceTableLink.Table.Copy();
   this.table = sourceTableLink.Table.Clone();
   foreach (RowLink sourceRow in sourceRows)
   {
     table.ImportRow(sourceRow.DataRow);
   }
 }
开发者ID:undyings,项目名称:Commune,代码行数:10,代码来源:ITableProvider.cs

示例15: QueryDataTable

 /// 執行 DataTable 中的查詢返回新的 DataTable
 /// </summary>
 /// <param name="dt">來源資料 DataTable</param>
 /// <param name="condition">查詢條件</param>
 /// <returns></returns>
 public DataTable QueryDataTable(DataTable dt, string condition, string sortstr)
 {
     DataTable newdt = new DataTable();
     newdt = dt.Clone();
     DataRow[] dr = dt.Select(condition, sortstr);
     for (int i = 0; i < dr.Length; i++)
     {
         newdt.ImportRow((DataRow)dr[i]);
     }
     return newdt;
 }
开发者ID:CalvertYang,项目名称:NPxP,代码行数:16,代码来源:DataHelper.cs


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