scmadden
6 years agoNew Contributor
Querying a SQL Server DB and returning more than one column
Instead of recording a script, I am attempting to query a given database table myself. I am able, but I am only able to return records for one column. Is there a way I can append to what I have here ...
- 6 years ago
Hello scmadden
"Is there a way I can append to what I have here in the while loop to add columns and view as a table in my log?"
Yes, there is a way to achieve this and see results in Your log results.
1) Store data in an object, using a while loop or another simple solution in Your code.
2) Create a html string using this object:
let html = "<table style=\"width:100%\">"; html += "<tr>"; html += "<th>Your data</th>"; for (let x = 1; x <= length; x++) { html += "<th>Value" + x + "</th>"; } html += "</tr>"; html += "<tr>";
3) use these values in Your log report using
var attr = Log.CreateNewAttributes(); attr.ExtendedMessageAsPlainText = false; Log.Message("Check table Values", html, 300, attr);
Check values in log and see the table in the "deails" tab.