กิจกรรม
17 มี.ค. 21 - 21 มี.ค. 10
แอปอัจฉริยะ เข้าร่วมชุด meetup เพื่อสร้างโซลูชัน AI ที่ปรับขนาดได้ตามกรณีการใช้งานจริงกับนักพัฒนาและผู้เชี่ยวชาญร่วมกัน
ลงทะเบียนตอนนี้เบราว์เซอร์นี้ไม่ได้รับการสนับสนุนอีกต่อไป
อัปเกรดเป็น Microsoft Edge เพื่อใช้ประโยชน์จากคุณลักษณะล่าสุด เช่น การอัปเดตความปลอดภัยและการสนับสนุนด้านเทคนิค
After you create a DataTable and define its structure using columns and constraints, you can add new rows of data to the table. To add a new row, declare a new variable as type DataRow. A new DataRow object is returned when you call the NewRow method. The DataTable then creates the DataRow object based on the structure of the table, as defined by the DataColumnCollection.
The following example demonstrates how to create a new row by calling the NewRow method.
Dim workRow As DataRow = workTable.NewRow()
DataRow workRow = workTable.NewRow();
You then can manipulate the newly added row using an index or the column name, as shown in the following example.
workRow("CustLName") = "Smith"
workRow(1) = "Smith"
workRow["CustLName"] = "Smith";
workRow[1] = "Smith";
After data is inserted into the new row, the Add method is used to add the row to the DataRowCollection, shown in the following code.
workTable.Rows.Add(workRow)
workTable.Rows.Add(workRow);
You can also call the Add method to add a new row by passing in an array of values, typed as Object, as shown in the following example.
workTable.Rows.Add(new Object() {1, "Smith"})
workTable.Rows.Add(new Object[] {1, "Smith"});
Passing an array of values, typed as Object, to the Add method creates a new row inside the table and sets its column values to the values in the object array. Note that values in the array are matched sequentially to the columns, based on the order in which they appear in the table.
The following example adds 10 rows to the newly created Customers table.
Dim workRow As DataRow
Dim i As Integer
For i = 0 To 9
workRow = workTable.NewRow()
workRow(0) = i
workRow(1) = "CustName" & I.ToString()
workTable.Rows.Add(workRow)
Next
DataRow workRow;
for (int i = 0; i <= 9; i++)
{
workRow = workTable.NewRow();
workRow[0] = i;
workRow[1] = "CustName" + i.ToString();
workTable.Rows.Add(workRow);
}
กิจกรรม
17 มี.ค. 21 - 21 มี.ค. 10
แอปอัจฉริยะ เข้าร่วมชุด meetup เพื่อสร้างโซลูชัน AI ที่ปรับขนาดได้ตามกรณีการใช้งานจริงกับนักพัฒนาและผู้เชี่ยวชาญร่วมกัน
ลงทะเบียนตอนนี้การฝึกอบรม
โมดูล
Add new objects to Dynamics 365 Business Central - Training
Do you want to know how to add objects, like tables and pages, to Microsoft Dynamics 365 Business Central? If so, this module is for you. In this module, you'll learn how to create tables and pages for an extension.