したがって、InsertAt() 部分である 1 行を除いて機能するコードのスニペットがここにあります。最後の行をコピーして最初の行として挿入できるかどうかを知りたいです。考え方としてはこう考えてください。おそらくその背後にあるSQLだけで実行できますが、このアプリケーションは非常に古いデータベースとオラクルの両方で機能するように設計されているため、システムが完全に移行されるまで、残念ながらこのように実行する必要があります.
前
- 出荷場所 1
- 出荷場所 2
- 出荷場所 2
後
- 開始場所
- 出荷場所 1
- 出荷場所 2
- 出荷場所 3
- 目的地の場所
コード スニペット:
// Create a DataTable with a list of shipments.
DataTable dt = c.Query(c.qShipments(Row.Cells[0].Value.ToString()));
// Check if there is at least one shipment
if (dt.Rows.Count >= 1)
{
// Add the destination of the shipments
dt.Rows.Add(0, 0, 9999, textBox_CC.Text, textBox_PC.Text, textBox_SL.Text);
// Add the starting location (which is the same as the destination. It has to be at the top of the DataTable
dt.Rows.InsertAt(dt.Rows[dt.Rows.Count - 1], 0); // The code
// Finally calculate and return the object to populate the datagridview with.
dataGridView_CalculatedRoutes.Rows.Add(x.getRoute(dt));
}
tldr;
問題: コードは、別のテーブルに属している行を返します。
質問: 最後の行を最初の行にする方法は?
編集の質問: 最後の行を最初の行と最後の行の両方にする方法。(同一行)