First off, appending the values from your input to your SQL statement is a big NO NO, as it can lead you to SQL injection attack. Read:
Protect Your Data: Prevent SQL Injection[^]
Second, please use the debugger to figure out what went wrong with your code logic. You simply need to set a break point and step into your code to see what's going on there.
Third, I'm not a VB person but looking at your code, it seems like you are always overwriting the first items of your DataList. Can you try doing something like this instead:
Dim CategoryLabel As Label = DirectCast(DataList1.Items(row1).FindControl("CategoryLabel"), Label)
CategoryLabel.Text = DirectCast(dt2.Rows(row1)(0), String)
Dim UserLabel As Label = DirectCast(DataList1.Items(row1).FindControl("UserLabel"), Label)
UserLabel.Text = DirectCast(dt2.Rows(row1)(1), String)
What I changed there is just update the
DataList
Item
index value to
row1
instead of
0
.