c# - Populate Listbox from a table having a XML column -
have landed in problem, tryin work since day. have table having varchar column , xml column.the schema below:
create table dbo.standardview( name varchar(50), fields xml)
i inserted record below:
insert dbo.standardview values('standard',n'<fieldname>firstname,secondname,thirdname</fieldname>')
i need populate listbox entities follows:
firstname secondname thirdname
the code populate listbox written below:
protected void page_load(object sender, eventargs e) { if (!ispostback) { populatevalues(); } } public void populatevalues() { sqldataadapter da = new sqldataadapter("select * dbo.standardview", xconn); datatable dt = new datatable(); da.fill(dt); lstbox.datasource = dt; lstbox.datatextfield = dt.columns[1].tostring(); lstbox.datavaluefield = dt.columns[1].tostring(); lstbox.databind(); }
the above code puts whole xml column in listbox in string format , pretty evident.
i tried xmlserializer,deserializer , xmlreader stuffs wasn't able populate listbox accordingly.
experts please guide.
create class properties firstname, secondname, thirdname , when extract xml column create list of class , populate list xml data bind list listbox.
Comments
Post a Comment