i want to combine 2 columns as one and align 2nd col combined.
Example (i want to combine company id and name as 1 column),
coid coname
co1 company 1
comp2 company 2
companyid3 company 3
----------------------
if i simply do select coid + ' ' + coname from mytable, then it gives me result as,
co1 company 1
comp2 company 2
companyid3 company 3
i want to align 2nd col (i.e. coname to like ),
co1 company 1
comp2 company 2
companyid3 company 3
----------------
My code, (i am trying following code) - But still not aligned
i am trying to get max length of coid then add accordingly. In above e.g. add only 5 spaces to 3rd record, add 10 spaces in 2nd record and add 12 spaces in 1st. But still no use may be bucause width of individual character. Anyone have have any idea to do this.
Dim mySql As String = "declare @len1 int " & Chr(10)
mySql = mySql & "select @len1 = max(len(coid)) from mytable" & Chr(10)
mySql = mySql & "select coid, coid + space(@len1-len(coyid)+5) + coname as coname from mytable order by coid" & Chr(10)
Dim sqladp As New SqlClient.SqlDataAdapter(mySql, _SqlCon.sqlCon)
i want to show this in combobox. So user can select from list.