这样:
For i As Integer = 1 To 2 If e.Form.Controls("机柜编号"& i).Value isnot nothing then Dim r As DataRow = DataTables("板盘台帐表").Addnew r("机柜编号") = e.Form.Controls("机柜编号"& i).Value r("板盘类型") = e.Form.Controls("板盘类型"& i).Value '... NextNext