本文整理匯總了C#中System.Data.DataTable.Merge方法的典型用法代碼示例。如果您正苦於以下問題:C# DataTable.Merge方法的具體用法?C# DataTable.Merge怎麽用?C# DataTable.Merge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Data.DataTable
的用法示例。
在下文中一共展示了DataTable.Merge方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ProcessRequest
public void ProcessRequest(HttpContext context)
{
DataSet ds = new DataSet();
context.Response.ContentType = "application/json";
context.Response.ContentEncoding = Encoding.UTF8;
object[] ob = new object[5];
ob[0] = context.Request["iMode"];
ob[1] = Convert.ToDateTime(funDatetime(Convert.ToString(context.Request["StartDate"])));
// ob[1] = Convert.ToDateTime(context.Request["StartDate"]);
ob[2] = Convert.ToDateTime(funDatetime(Convert.ToString(context.Request["EndDate"])));
// ob[2] = Convert.ToDateTime(context.Request["EndDate"]);
ob[3] = Convert.ToInt32(context.Request["CompanyID"]);
ob[4] = Convert.ToInt32(context.Request["BranchID"]);
ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_ReportChart]", ob);
if (ds.Tables.Count > 1)
{
DataTable dt = new DataTable();
dt.Merge(ds.Tables[0]);
dt.Merge(ds.Tables[1]);
context.Response.Write(Json.GetJson(dt));
}
else
{
if (ds.Tables.Count > 0)
{
context.Response.Write(Json.GetJson(ds.Tables[0]));
}
}
}
示例2: GetAllDatabaseData
public DataTable GetAllDatabaseData()
{
Dictionary<string, string> tabs = new Dictionary<string, string>()
{
{"Websites Loaded", "webpage_log"},
{"Websites Actions", "webpage_actions"},
{"OSIRT Actions", "osirt_actions" },
{"Attachments", "attachments" },
{"Videos", "videos" },
};
DataTable merged = new DataTable();
foreach (string table in tabs.Values)
{
string columns = DatabaseTableHelper.GetTableColumns(table);
DataTable data = GetRowsFromColumns(table: table, columns: columns);
merged.Merge(data, true, MissingSchemaAction.Add);
}
DataTable dt = new DatabaseHandler().GetRowsFromColumns("case_notes", "", "date", "time", "note");
merged.Merge(dt, true, MissingSchemaAction.Add);
merged.TableName = "merged";
DataView view = new DataView(merged);
view.Sort = "date asc, time asc";
DataTable sortedTable = view.ToTable();
return sortedTable;
}
示例3: Main
public static void Main(string[] args)
{
// jsc needs to see args to make Main into main for javac..
// see also>
// X:\jsc.svn\examples\javascript\android\AndroidBroadcastLogger\AndroidBroadcastLogger\ApplicationWebService.cs
System.Console.WriteLine(
typeof(object).AssemblyQualifiedName
);
// java.lang.Object, rt
//'JVMCLRDataTableMerge.exe' (CLR v4.0.30319: JVMCLRDataTableMerge.exe): Loaded 'X:\jsc.svn\examples\java\JVMCLRDataTableMerge\JVMCLRDataTableMerge\bin\Release\JVMCLRDataTableMerge.exports'. Module was built without symbols.
//The program '[12004] JVMCLRDataTableMerge.exe' has exited with code 0 (0x0).
//System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Console.WriteLine("ApplicationWebService cctor");
var o0 = ScriptedNotifications0.GetDataTable();
var o1 = ScriptedNotifications.GetDataTable();
var merge = new DataTable();
merge.Merge(o0);
merge.Merge(o1);
Console.WriteLine("ApplicationWebService cctor done");
CLRProgram.CLRMain();
}
示例4: VerFachada1
public DataTable VerFachada1()
{
oTabla = oAgente.ListarAgente();
oTabla2 = oCliente.ListarCliente();
oTabla3 = oPunto.ListarPuntoVenta();
oTabla.Merge(oCliente.ListarCliente());
oTabla.Merge(oPunto.ListarPuntoVenta());
return oTabla;
}
示例5: ObtenerReservaciones
/// <summary>
/// Obtiene todas las reservaciones hechas en el sistema
/// </summary>
/// <returns>DataTable Object (start,end,name,id)</returns>
public DataTable ObtenerReservaciones()
{
DataTable toReturn = new DataTable();
toReturn.Columns.Add("start", typeof(DateTime));
toReturn.Columns.Add("end", typeof(DateTime));
toReturn.Columns.Add("name", typeof(string));
toReturn.Columns.Add("id", typeof(string));
toReturn.Merge(ObtenerEventos());
toReturn.Merge(ObtenerCursos());
toReturn.Merge(ObtenerAprobaciones());
return toReturn;
}
示例6: ProcessRequest
public void ProcessRequest(HttpContext context)
{
DataSet ds = new DataSet();
string mode = context.Request["handler_mode"];
if (mode == "print")
{
object[] ob = new object[2];
ob[0] = Convert.ToInt32(context.Request["pid"]);
ob[1] = context.Request["imode"];
ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "spu_InvoicePrint", ob);
}
context.Response.ContentType = "application/json";
context.Response.ContentEncoding = Encoding.UTF8;
if (ds.Tables.Count > 0)
{
if (ds.Tables.Count > 1)
{
DataTable dt = new DataTable();
for (var i = 0; i < ds.Tables.Count; i++)
{
dt.Merge(ds.Tables[i]);
}
context.Response.Write(Json.GetJson(dt));
}
else
{
context.Response.Write(Json.GetJson(ds.Tables[0]));
}
}
}
示例7: ObtenerAprobaciones
/// <summary>
/// Obtiene todas las reservaciones hechas por la aprobacion de una solicitud
/// </summary>
/// <returns>DataTable Object (start,end,name,id)</returns>
private DataTable ObtenerAprobaciones()
{
cUDGDFAPROBACIONNegocios cAprobaciones = new cUDGDFAPROBACIONNegocios(0, "", 0, "");
DataTable dtAprobaciones = cAprobaciones.Seleccionar_Todo_Detallado();
DataTable toReturn = new DataTable();
toReturn.Columns.Add("start", typeof(DateTime));
toReturn.Columns.Add("end", typeof(DateTime));
toReturn.Columns.Add("name", typeof(string));
toReturn.Columns.Add("id", typeof(string));
String sFechainicio, sFechafin, sHorainicio, sHorafin, sDescripcion;
String sID;
Boolean blunes, bmartes, bmiercoles, bjueves, bviernes, bsabado, bdomingo;
foreach (DataRow drLocalRow in dtAprobaciones.Rows)
{
sFechainicio = drLocalRow[1].ToString();
sFechafin = drLocalRow[2].ToString();
sHorainicio = drLocalRow[3].ToString();
sHorafin = drLocalRow[4].ToString();
sDescripcion = "Reservacion de " + drLocalRow[5].ToString();
sID = "Reservacion:" + int.Parse(drLocalRow[0].ToString());
blunes = true;
bmartes = true;
bmiercoles = true;
bjueves = true;
bviernes = true;
bsabado = true;
bdomingo = true;
toReturn.Merge(ObtenerFechas(sFechainicio, sFechafin, sHorainicio, sHorafin, sDescripcion, sID, blunes, bmartes, bmiercoles, bjueves, bviernes, bsabado, bdomingo));
}
return toReturn;
}
示例8: ddlCourses_SelectedIndexChanged
protected void ddlCourses_SelectedIndexChanged(object sender, EventArgs e)
{
int courseID = int.Parse(ddlCourses.SelectedValue);
Course course = (Course.GetCourse(courseID)).ElementAt(0);
IEnumerable<Session> sessions = Classes.Session.GetSessionsByCourseID(courseID);
//IEnumerable<ClientSession> clientSessions = (ClientSession.GetClientSessionsByClientID(clientID));
DataTable sessionsTable = new DataTable("SessionsTable");
foreach (Session sesh in sessions)
{
using (DatabaseConnection db = new DatabaseConnection("dbo.GetSession"))
{
// Set Parameters
db.comm.Parameters.AddWithValue("SessionID", sesh.SessionID);
// Open Connection
db.conn.Open();
// Execute Command
SqlDataAdapter MyAdapter = new SqlDataAdapter();
MyAdapter.SelectCommand = db.comm;
DataTable table = new DataTable();
// Read Response
MyAdapter.Fill(table);
sessionsTable.Merge(table);
db.Dispose();
}
}
modSessionTable(sessionsTable);
//gvSessions.DataSource = sessionsTable.DefaultView;
//gvSessions.DataBind();
}
示例9: displayNPTMetricsX
public static string displayNPTMetricsX(List<string> _arr)
{
DataTable dummy = new DataTable();
dummy.Columns.Add("TaskName");
dummy.Columns.Add("Start");
dummy.Columns.Add("End");
dummy.Columns.Add("Elapsed");
SystemObjects.OPT _opt = new SystemObjects.OPT();
_opt.WorkdayID = Convert.ToInt32(_arr[0]);
DataSet ds = new DataSet();
try
{
dummy.Merge(_opt.DisplayNPTMetricsX());
if (dummy.Rows.Count < 1)
{
dummy.Rows.Add();
}
ds.Tables.Add(dummy);
}
catch (Exception ex)
{
}
return ds.GetXml();
}
示例10: ButtonSubmit_Click
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
string InstanceName = TextBoxSource.Text;
//List Catalogs(DBs)
string strMDX = "select * from $system.DBSCHEMA_CATALOGS";
string strConnString = "Datasource=" + InstanceName;
System.Data.DataTable dtDB = GetDataTable(strConnString, strMDX); //returns data table with DB details
//Enumerate cubes in each database
ArrayList DBList = ReturnValueFromDataTable(dtDB, 0); //Get DB Name (Catalog_Name) from data table
dtDB.Dispose();
System.Data.DataTable dtCubes = new System.Data.DataTable();
System.Data.DataTable dtPartial = new System.Data.DataTable();
foreach (string DBName in DBList)
{
strMDX = "SELECT * FROM $system.MDSchema_Cubes WHERE CUBE_SOURCE=1";
strConnString = "Datasource=" + TextBoxSource.Text + ";Catalog=" + DBName;
dtPartial = GetDataTable(strConnString, strMDX); //get all Cubes for the DB DBName
DataColumn CubeLink = dtPartial.Columns.Add("Link"); // Add a column "Link" in the data table
CubeLink.SetOrdinal(0); //make new column as first column in table
dtCubes.Merge(dtPartial);
dtPartial.Dispose();
}
GridViewResults.AutoGenerateColumns = true;
GridViewResults.DataSource = dtCubes; //returns data table with DB details
GridViewResults.DataBind();
dtCubes.Dispose();
}
示例11: TreeNodePopulate
//Populate tree node
public void TreeNodePopulate(TreeNodeCollection nodes, IToken token)
{
//Parents nodes
treeNodes = authorManager.getAllPermission();
treeNodes.Merge(authorManager.getAuthoritiesByToken(token));
CreateRootNode(nodes);
}
示例12: ProcessSubmitChangesResultOK
/// <summary>
/// Processes the result of a data submission to the Server where the result of that operation is
/// <see cref="TSubmitChangesResult.scrOK" />. (Overload for DataTables.)
/// </summary>
/// <param name="ACallingFormOrUserControl"></param>
/// <param name="ALocalDT"></param>
/// <param name="ASubmitDT"></param>
/// <param name="APetraUtilsObject"></param>
/// <param name="AVerificationResults"></param>
/// <param name="ASetPrimaryKeyOnlyMethod"></param>
/// <param name="AMasterDataTableSaveCall"></param>
/// <param name="ACalledFromUserControl"></param>
/// <param name="ACallAcceptChangesOnReturnedDataBeforeMerge"></param>
public static void ProcessSubmitChangesResultOK(IFrmPetra ACallingFormOrUserControl, DataTable ALocalDT,
DataTable ASubmitDT, TFrmPetraEditUtils APetraUtilsObject, TVerificationResultCollection AVerificationResults,
Action <bool>ASetPrimaryKeyOnlyMethod, bool AMasterDataTableSaveCall, bool ACalledFromUserControl,
bool ACallAcceptChangesOnReturnedDataBeforeMerge = false)
{
if (AMasterDataTableSaveCall)
{
// Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server
ALocalDT.AcceptChanges();
// Merge back with data from the Server (eg. for getting Sequence values)
if (ACallAcceptChangesOnReturnedDataBeforeMerge)
{
ASubmitDT.AcceptChanges();
}
ALocalDT.Merge(ASubmitDT, false);
// Need to accept any new modification ID's
ALocalDT.AcceptChanges();
if (ASetPrimaryKeyOnlyMethod != null)
{
// Ensure the Primary-Key(s)-containing Controls are disabled to prevent further modification of Primary Key values
ASetPrimaryKeyOnlyMethod(true);
}
}
CommonPostMergeOperations(ACallingFormOrUserControl, APetraUtilsObject,
AVerificationResults, ACalledFromUserControl);
}
示例13: GetAllRecords
// récupère toutes les valeurs d'une table donnée
// renvoie un Dataset
public static DataSet GetAllRecords(string lobSystemInstance, string entityName)
{
DataSet ds = new DataSet(entityName);
NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
LobSystemInstance instance = sysInstances[lobSystemInstance];
Entity entity = instance.GetEntities()[entityName];
// Get the finder method
MethodInstance finder = entity.GetFinderMethodInstance();
//Execute Finder method
DbEntityInstanceEnumerator records = (DbEntityInstanceEnumerator)entity.Execute(finder, instance);
//Load matching entities into a DataTable
DataTable entitiesTable = new DataTable();
while (records.MoveNext())
{
//Load each entity and include the Action URL
DbEntityInstance record = (DbEntityInstance)records.Current;
DataTable entityTable = record.EntityAsDataTable;
entityTable.AcceptChanges();
entitiesTable.Merge(entityTable);
}
//DataTable ordersTable = customerOrders.Tables.Add(“Orders”);
ds.Tables.Add(entitiesTable);
return ds;
}
示例14: displayNpt
public static string displayNpt(List<string> _arr)
{
DataTable dummy = new DataTable();
dummy.Columns.Add("Task Name");
dummy.Columns.Add("Status");
SystemObjects.OPT _opt = new SystemObjects.OPT();
_opt.TeamID = Convert.ToInt32(_arr[0].ToString());
DataSet ds = new DataSet();
try
{
dummy.Merge(_opt.DisplayNptTask());
if (dummy.Rows.Count < 1)
{
dummy.Rows.Add();
}
ds.Tables.Add(dummy);
}
catch (Exception ex)
{
}
return ds.GetXml();
}
示例15: displayReARTickets
public static string displayReARTickets(List<string> _arr)
{
DataTable dummy = new DataTable();
dummy.Columns.Add("TicketNo", typeof(Int64));
dummy.Columns.Add("ConcernAction", typeof(String));
dummy.Columns.Add("TicketDescription", typeof(String));
dummy.Columns.Add("TicketDate", typeof(DateTime));
dummy.Columns.Add("TicketStatus", typeof(String));
dummy.Columns.Add("SummaryOfConcern", typeof(String));
SystemObjects.ReARObj _rearobj = new SystemObjects.ReARObj();
_rearobj.WorkdayID = Convert.ToInt32(_arr[0].ToString());
DataSet ds = new DataSet();
try
{
dummy.Merge(_rearobj.displayReAR(Convert.ToBoolean(_arr[1].ToString())));
if (dummy.Rows.Count < 1)
{
dummy.Rows.Add();
}
ds.Tables.Add(dummy);
}
catch (Exception ex)
{
}
return ds.GetXml();
}