asp.net - loop multiple table from dataset -


i have 2 table in dataset, trying achieve convert 2 table item string

public shared function mtdcdstostr(byval pdataset dataset) string         dim sds string         dim sb new system.text.stringbuilder           dim drrow datarow         dim dccolumn datacolumn         dim dttable datatable         dim x integer = 0          each dttable in pdataset.tables             each drrow in pdataset.tables(x).rows                 dim colname(pdataset.tables(x).columns.count) string                 dim integer = 0                 each dccolumn in pdataset.tables(0).columns                     colname(i) = dccolumn.columnname                     sb.append(colname(i) + "," + drrow(colname(i)).tostring + ",")                     += 1                 next                  sb.append("|")             next               x += 1             sb.append("$")         next           sds = sb.tostring          return sds     end function 

code explanation function pass in dataset , convert dataset string trying achieve convert multiple datatable string can loop 1 table in code above, should in order loop multi table? =(

change below

for each dttable datatable in dataset.tables     each dr datarow in dttable.rows         each column datacolumn in dttable.columns             sb.append(column.columnname + "," & dr(column.columnname).tostring() & ",")         next         sb.append("|")     next     sb.append("$") next 

but rather converting dataset string may try get xml dataset. i'm not sure exact requirement converting sting, xml way communicate data.

xmlstring =lpdataset.getxml()  

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -