Click here to Skip to main content
15,112,667 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have one textbox of name in my form and i want to fetch its value from database from three fields first_name , middle_name and last name present in my database

1 solution

You haven't told us where you are stuck or what your question is so I'll briefly go over what you need to do.

In SQL, you can easily concatenate fields by doing something similar to:
SELECT first_name + ' ' + middle_name + ' ' + last_name AS FullName FROM table1

Now, in your form you connect to the db with a SqlConnection object and using a DataReader you then set your textbox value.

txtFullName.Text = dr["FullName"].ToString();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900