Monday, 6 May 2024     

Login     
 
 Forum Minimize
HomeHomeVB.Net 2.0 or 3...VB.Net 2.0 or 3...GeneralGeneralConcatenate two columns in a DataViewConcatenate two columns in a DataView
Previous
 
Next
New Post
26/01/2009 11:11 PM
 

Here is an example of how to concatenate two columns in a DataView or DataSet using a DataView when you can not change the SQL query, which is the best way. But there maybe times when you are using a web service for example where you can not change the query but you want to manipulate the resultant data to create a concatenated field.

 

 

Dim sDS As DataSet
Dim sDV As DataView
Dim newColumn As DataColumnTry

sDS = Globals.GetCustomerContactList
sDV = sDS.Tables(0).DefaultView

newColumn =

cmbContacts.ValueMember =

 

New DataColumn("ContactFullName"
newColumn.Expression = "LastName + ', ' + FirstName"
sDV.Table.Columns.Add(newColumn)

cmbContacts.DataSource = sDV
"CustomerContactId"
cmbContacts.DisplayMember =
Catch ex As Exception
MessageBox.Show("oh No")
Finally

sDS =

Nothing
sDV = Nothing

newColumn =

 

End Try

 

 

 
Previous
 
Next
HomeHomeVB.Net 2.0 or 3...VB.Net 2.0 or 3...GeneralGeneralConcatenate two columns in a DataViewConcatenate two columns in a DataView



    
Terms Of Use   Privacy Statement  
Copyright (c) 2024 Apaloon