Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi guys!

I have a table that consist fields of id,lastname, firstname and the middlename. Now, I need to display in one textbox the fullname where the id matches. Can Anyone help me out?
Posted
Comments
jaket-cp 19-Dec-14 12:29pm    
Any code you need help on?
joshrduncan2012 19-Dec-14 12:36pm    
What have you tried? Where are you stuck?
Schatak 20-Dec-14 0:17am    
try something by yourself... if you stuck then ask for solution

There are many articles about data access on CP, here's one of mine:
Simplified Database Access via ADO.NET Interfaces[^]
 
Share this answer
 
Comments
CPallini 19-Dec-14 16:03pm    
Shameless Self Promotion? :-) Have my 5.
PIEBALDconsult 19-Dec-14 16:11pm    
Thanks. I just make sure I don't try to hide it.
SqlCommand query = new SqlCommand("SELECT lastname, firstname, middlename  FROM tblStudent WHERE fldID='" + txtSearch.Text + "'", amicassaCon);
          SqlDataReader dr = query.ExecuteReader();
          while (dr.Read())
          {
              string a = dr[1].ToString();
            string b = dr[2].ToString();
             string c= dr[3].ToString();
              txtName.Text = a + ',' + b + ' ' + c;
          dr.Close();
 
Share this answer
 
SELECT ISNULL(firstname,'') +' '+ ISNULL(middlename,'') + ' ' + ISNULL(lastname,'') FROM Tblusers
 
Share this answer
 

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