c# - Added Comma when Printing DataTable as String -
c# - Added Comma when Printing DataTable as String -
in next code passing through every element of datatable , adding string.
foreach(datacolumn column in table.columns) { if (firstpass) { firstpass = false; continue; } toreturn += column.columnname + ","; } toreturn += ";"; firstpass = true; foreach (datarow row in table.rows) { foreach (datacolumn column in table.columns) { if (firstpass) { firstpass = false; continue; } toreturn += row[column].tostring() + " "; } firstpass = true; } homecoming toreturn;
result:
"cad,celiac,hypertension,anticoagulates,ace inhibitors,insulin,;176 25 296 109 73 " + "353 195 18 300 92 73 377 "
can explain why string returned function has concatenation operator (plus sign)? trying create comma delimited string causing problems when interpret string in different class.
wcf test client breaks string , concatenates display in "value" column. see previous question: wcf test client breaks string value
c# sql-server datatable
Comments
Post a Comment