How to create a datalist table layout in vb?
I am using vb .net
I have a following data:
DataBase: databaseName
Table : tableName
--------------------
| ID | randomNames |
--------------------
| 1 | name1 |
| 2 | name2 |
| 3 | name3 |
| 4 | name4 |
| 5 | name5 |
| 6 | name6 |
--------------------
I want to take all the data from database and display datalist table in the following format.
------------------------
|name1 | name2 | name3 |
|name4 | name5 | name6 |
------------------------
I set up the code but having hard time understanding how to format it like a table.
Try
sqlConn.Open()
Dim cmd = New SqlCommand(SelectQuery, sqlConn)
reader = cmd.ExecuteReader()
While reader.Read()
dr = dt.NewRow()
dr(0) = reader(1)
dt.Rows.Add(dr)
'return a DataView to the DataTable
CreateDataSource = New DataView(dt)
End While
Catch ex As Exception
ErrorL.Text = "Error1 - Can't connect to database.<br/>" & ex.Message
End Try