本文整理匯總了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();
}
}
示例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 += " ";
}
//獲取子部門數據
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;
}
示例3: ImportRowToDataTable
public static void ImportRowToDataTable(ref DataTable dt, DataRow[] rows)
{
foreach (DataRow r in rows)
{
dt.ImportRow(r);
}
}
示例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);
}
}
}
}
示例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;
}
示例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
}
示例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;
}
}
示例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();
}
}
}
}
}
示例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);
}
示例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);
}
示例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
}
示例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
}
示例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;
}
示例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);
}
}
示例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;
}