Hi there,
I have as script that runs a stored procedure to fetch a comment along with it's id. There are multiple comments and I want to display them but I am having problem with display all the records. Here is my code:
Using con
Using sda As New SqlDataAdapter()
Try
cmd.Connection = con
Catch ex As Exception
Response.Write("Error" & ex.Message)
Finally
con.Close()
End Try
sda.SelectCommand = cmd
Using ds As New DataSet()
sda.Fill(ds)
If ds.Tables(0).Rows.Count = 0 Then
Response.Write("No Comment")
Else
Dim dt As DataTable
Dim dr As DataRow
dt = ds.Tables(0)
For Each dr In dt.Rows
lblID.Text += dr("commenttId").ToString()
lblComment.Text += dr("comment").ToString()
Next dr
ds.Dispose()
End If
End Using
End Using
End Using
The returned results is grouped as ids and comments:
67
How do I make it so that the returned results will be like this:
6 First Comment
7 Second Comment
Thank you.