Combining columns

DaveP

Member
Joined
Jan 24, 2008
Messages
12
Programming Experience
1-3
I am using VB2010 and reading data from an Excel database using ACE.OLEDB
I want to combine columns read from the dataset into a single combobox. I can do this by creating a new column as I fill my dataset, like this

SQL="Select Position,ID,(Surname + ", " + Firstname) asFullName from MyDataBaseTable
daCon=New OleAdapter(SQL,myDataSet)
daCon.Fill(MyDataSet,"NameList")
dv=New Dataview(myDataSet.tables("Namelist")
cmbPickName.Datasource=dv
cmbPickname.DisplayMember=Position
cmbPickname.DisplayValue=ID

The problem is that as long as there is a valid value for both Surname and Firstname I get a string like "Smith, Brian"
but if there is no Firstname I thought I would just get the Surname but infact I get an empty string.

Is there some other syntax that will concatenate the fields without this happening or otherwise handling the null entry during the handling of the data adapter
 
Back
Top