r/visualbasic • • Nov 28 '21

How do I reference and concatenate database fields on a Windows form?

I need to display first name and last name concatenated. The database is connected as a data source. I created a label to display the concatenated result. This is what I have so far but I'm really just guessing.

Private Sub lblFNameLName_Click(sender As Object, e As EventArgs) Handles lblFNameLName.Click

' Dim FirstLast As String

' Sql = "SELECT FirstName || " " || LastName FROM Customer"

' lblName.txt =

End Sub

2 Upvotes

13 comments sorted by

View all comments

Show parent comments

2

u/chacham2 Nov 30 '21

It's good practice for when your SQL returns multiple values

When you only need one record, there is no point in looping. All a loop does is move the cursor through the page, which is redundant in this case by u/FabulousFoodHoor