hi friend,
u can split string by any char as ur wish
ex:
string items="one,two,three";
string[] itemArray=items.Split(',');
now u can get
itemArray[0]=one like this
Try it out
Prabu
But, How do I bind that to a listbox.
I am working in asp.net 2.0 and using vb script.
Let us assume i have table
"A_desktops" with columns
assetcode and
swinstalled.
Assecode Swinstalled
D001 sql,vb,Sap
D002 vs 2005, sql 2005
D003 Microsoft SQL Server 2000 Microsoft Office 97, Std Edition SAP
When i bind the data based on asset code say D003 to listbox it bind as
Microsoft SQL Server 2000 Microsoft Office 97, Std Edition SAP But i want them to display different listitems after comma.
I have the following code,
Sub ListLoad()
' ||||| DECLARE VARIABLES |||||
Dim strProducts As String = "select swinstalled from a_desktops where assetcode='" & TextBox1.Text & "'"
Dim Cmd As New SqlCommand(strProducts, dbconn)
Dim objReader As SqlDataReader
Dim itemArray() As String = strProducts.Split(",")
Try
If dbconn.State = ConnectionState.Closed Then
dbconn.Open()
End If
objReader = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
lstselectedemployees.Items.Clear()
lstselectedemployees.DataTextField = "Swinstalled"
lstselectedemployees.DataSource = objReader
lstselectedemployees.DataBind()
objReader.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try