本文整理汇总了C#中System.Data.DataTable.ImportRow方法的典型用法代码示例。如果您正苦于以下问题:C# System.Data.DataTable.ImportRow方法的具体用法?C# System.Data.DataTable.ImportRow怎么用?C# System.Data.DataTable.ImportRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataTable
的用法示例。
在下文中一共展示了System.Data.DataTable.ImportRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectedRowsDataSet
public static System.Data.DataSet SelectedRowsDataSet(System.Data.DataView dv, ArrayList selectedRows)
{
System.Data.DataSet ds = new System.Data.DataSet();
System.Data.DataTable dt = new System.Data.DataTable();
System.Data.DataRowView[] selectedRowsView = new System.Data.DataRowView[selectedRows.Count];
foreach(System.Data.DataColumn col in dv.Table.Columns)
{
dt.Columns.Add(col.ColumnName, col.DataType);
}
for (int i = 0; i < selectedRows.Count; i++)
{
dt.ImportRow(dv[(int)(selectedRows.ToArray())[i]].Row);
}
ds.Tables.Add(dt);
return(ds);
}
示例2: GetTables
/// <summary>
/// Gets a description of the tables available for the catalog
/// </summary>
/// <param name="catalog">A catalog, retrieves those without a catalog</param>
/// <param name="schemaPattern">Schema pattern, retrieves those without the schema</param>
/// <param name="tableNamePattern">A table name pattern</param>
/// <param name="types">a list of table types to include</param>
/// <returns>Each row</returns>
public System.Data.DataTable GetTables(System.String catalog, System.String schemaPattern, System.String tableNamePattern, System.String[] types)
{
OpenConnection();
schemaData = this.Connection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, new System.Object[] { catalog, schemaPattern, tableNamePattern, types[0] });
if (types != null)
{
for (int i = 1; i < types.Length; i++)
{
System.Data.DataTable temp_Table = this.Connection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, new System.Object[] { catalog, schemaPattern, tableNamePattern, types[i] });
for (int j = 0; j < temp_Table.Rows.Count; j++)
{
schemaData.ImportRow(temp_Table.Rows[j]);
}
}
}
CloseConnection();
return schemaData;
}