concatenate to db fields in to one datagrid column

Posted on 2006-11-29
Last Modified: 2010-04-23
I would like to append first name and last name that appear in 2 fields into 1 field in my datagrid

please help !
Question by:prowebinteractive
  • 3
  • 2

Expert Comment

ID: 18039341

Author Comment

ID: 18039511
I tried this doesnt seem to work.... im getting a "0" in the field

Expert Comment

ID: 18039601
Can you show some code?

Author Comment

ID: 18039616
       Dim SqlString As String = "SELECT a.accountNumber, SU.fname + ' ' + SU.lname AS repName, p.nom, p.prenom, p.telHome, d.dealerName, ST.statusName AS accountStatus FROM accounts AS a INNER JOIN profiles AS p ON a.accountNumber=p.accountNumber INNER JOIN dealers AS d ON a.dealerId=d.dealerId INNER JOIN sysusers AS SU ON d.repId=SU.sysUserId LEFT JOIN accountStatus AS ST ON a.accountStatus=ST.statusId WHERE p.profile_type=1 and (a.accountStatus != 1 AND a.accountStatus != 8) AND a.deleted='false' ORDER BY ST.priority"
        Dim da As MySql.Data.MySqlClient.MySqlDataAdapter = New MySql.Data.MySqlClient.MySqlDataAdapter(SqlString, conn)

Accepted Solution

Dimandja earned 500 total points
ID: 18039968
You have a typo.  Your concatenation should read (notice the comma between the apostrophies):

SU.fname +  ',  ' + SU.lname AS repName

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expando 4 46
C# Single Form 8 27
I need help making a collection from a class in VB.Net 3 25
Error "String or binary data would be truncated" in an update on a datatable 7 27
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: (…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now