0
我創建一個動態表這樣的:如何把垂直列放在動態表中? vb.net
'Item Number
Dim conItem As New SqlConnection
Dim cmdItem As New SqlCommand
conItem = FunctionConnection()
cmdItem.Connection = conItem
cmdItem.CommandText = "GetItemNumber"
cmdItem.CommandType = CommandType.StoredProcedure
Dim ItemNumber As SqlDataReader = Nothing
conItem.Open()
ItemNumber = cmdItem.ExecuteReader()
Dim Item As String = Nothing
Do While ItemNumber.Read()
Item = ItemNumber.GetValue(ItemNumber.GetOrdinal("ParagraphOrder"))
'Station
Dim conStation As New SqlConnection
Dim cmdStation As New SqlCommand
conStation = FunctionConnection()
cmdStation.Connection = conStation
cmdStation.CommandText = "GetStationValue"
cmdStation.CommandType = CommandType.StoredProcedure
cmdStation.Parameters.AddWithValue("@ParagraphOrder", Item)
Dim RowsStation As SqlDataReader = Nothing
conStation.Open()
RowsStation = cmdStation.ExecuteReader()
Dim Station As String = Nothing
Do While RowsStation.Read()
Station = RowsStation.GetValue(RowsStation.GetOrdinal("ActivityResource"))
TBLCell = New TableCell
TBLCell.Text = Station
TBLCell.HorizontalAlign = HorizontalAlign.Center
TBLCell.BorderStyle = BorderStyle.Solid
TBLCell.BorderColor = System.Drawing.Color.Black
TBLCell.BorderWidth = 1
TBLRow.Cells.Add(TBLCell)
TBLCell = New TableCell
TBLCell.Text = Item
TBLCell.HorizontalAlign = HorizontalAlign.Center
TBLCell.BorderStyle = BorderStyle.Solid
TBLCell.BorderColor = System.Drawing.Color.Black
TBLCell.BorderWidth = 1
TBLRow.Cells.Add(TBLCell)
Loop
conStation.Close()
Loop
conItem.Close()
我希望我的表有兩列,名稱與數字垂直。 兩個和兩個,不是這樣,一個單一的行。
我的表已創建與程序,並獲得每個單元格的值,但我想要一個垂直表,兩列不是一行。
「接收部件」的編號。 非常感謝
我解決了:TablVerificari.Rows.Add(TBLRow) TBLRow =新表格 –