How to Create ASP.NET inline Table using data from a DataReader?

Customization in a web app is very common. Requirement updates everyday. Depending on this it happens occasionally Gridview is incapable to meet customers demand. In this case we choose ASP.NET inline Table to present data. Commonly there are 2 ways to fetch data from the database DataSet & DataReader. DataSet is connection less architecture. While DataReader is a pointer. DataReader fetch data faster then DataSet mechanism.

Here in this below example I am fetching data from my table PortalWebLink. In side table tag before start the row (tr) I am with a while loop. The condition is until data read is readable bind data. Inside the td I am binding weblinks using dreaderobj(“WebLinkTitle”).ToString().

Table using data from a DataReader

<table border="0" cellpadding="4" cellspacing="1" width="100%" bgcolor="#e3eef6">
<%
Dim connObj As New SqlConnection(ConfigurationManager.AppSettings.Get("DBKey").ToString())
Dim qryStr As String = "SELECT * FROM PortalWebLink WHERE STATUS='ACTIVE' ORDER BY CreatedDate DESC"
'Response.Write(qryStr)
Dim sqlCommObj As New SqlCommand(qryStr, connObj)

Try
connObj.Open()
Dim dreaderobj As SqlDataReader = sqlCommObj.ExecuteReader

While dreaderobj.Read
%>
<tr>
<td bgcolor="#e3eef6">
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td>
<img src='../IMAGES/old-edit-redo.png' />
</td>
<td>
&nbsp;<a href='<%= dreaderobj("WebLink").ToString %>' target='blank'><%=dreaderobj("WebLinkTitle").ToString()%></a>
</td>
</tr>
</table>
</td>
</tr>
<%
End While
Catch ex As Exception
Dim TrackError As New ErrorLog()
TrackError.ErrorLog(ex.Message, ex.ToString(), ex.Source, ex.TargetSite.ToString(), "", "../Admin/Weblink.aspx", connObj)
Finally
connObj.Close()
End Try
%>
<%
Dim strChkQry As String = "SELECT Count(*) as CNT FROM PortalWebLink WHERE STATUS='ACTIVE'"
Dim sqlCommandObj As New SqlCommand(strChkQry, connObj)

try
connObj.Open()
Dim str As Object = sqlCommandObj.ExecuteScalar()
Dim i As Integer = str

If i = 0 Then
%>
<table cellpadding="2" cellspacing="2" width="100%" class="fbox">
<tr>
<td>
No Record(s) Found.
</td>
</tr>
</table>
<%
end if
Catch ex As Exception
Dim TrackError As New ErrorLog()
TrackError.ErrorLog(ex.Message, ex.ToString(), ex.Source, ex.TargetSite.ToString(), "", "../Admin/Weblink.aspx", connObj)
Finally
connObj.Close()
End Try
%>
<tr>
<td>
&nbsp;
</td>
</tr>
</table>