בתאריך יום שבת, 23 במרץ 2013 00:49:23 UTC+2, מאת ryandesign:
>
>
> On Mar 22, 2013, at 13:48, Adva wrote: 
>
> > im executing a stored procedre in node.js using jsonStringify to show 
> the results in the console. 
> > but now i want to put the results in a html table using tr and td. 
> > how can i do it? thank you! 
>
> What have you tried so far? Show us your code. 
>
>

this is my code:
i turn it to csv file. but now i want the results in a table and not in csv 
file:


exports.email = function (req, res) {
    var sql = require('msnodesql');
    var conn_str = "Driver=SQL Server Native Client 
10.0;Server=toyga-app02\\toyga;Database=ToygaDev;Trusted_Connection=Yes";

    sql.open(conn_str, function (err, conn) {
        if (err) {
            console.log("Database connection failed!");
            return;
        }

        conn.query("GetEmailTemplatesStatistics2 ?,?", dates, function 
(err, results) {
            if (err) {
                console.log("Error running query!");
                console.log(err);
                return;
            }
            if (!res.headersSent) {
                res.setHeader('Content-type', 'application/CSV');
                res.setHeader('content-disposition', 'attachment; 
filename=report.csv');
            }

            var firstRow = results[0];
            for (var item in firstRow) {
                res.write(item + ",");
            }
            res.write("\n");


            for (var i = 0; i < results.length; i++) {
                var row = results[i];
                for (var item in row) {
                    res.write(row[item] + ",");
                }
                res.write("\n");
            }

            res.end('');
        });
    });
} 

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to