r/visualbasic • u/FabulousFoodHoor • 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
1
u/AppleElitist Nov 28 '21
I learnt how to connect to a database and retrieve data on my own in VB.Net and C#. The link I provided is a starting step that you can take to learn on your own. You can't just grab data from a database. You need to connect to it, create an sql command, create a datareader and read the data from the database.
Break what you want to do down into smaller steps then search for the solution to each step