I am firing query to database and getting in json format .
I want to send it to client (browser) using express js.
but i am not getting the data in browser.

 app.post("/downloadImportedTable", function (req, res) {
       var connection = new sql.Connection(dbConfig, function (err) {
        
               var dbObject = req.body.tableName;
        if (err) {
            res.status(500).send(String(err));
        } else {
            // Query 
            var sqlrequest = new sql.Request(connection);
            sqlrequest.query('select * from ' + dbObject, function (err, 
recordset) {
                
                if (err) {
                    res.status(500).send(String(err));
                    connection.close();
                } else {
                    //console.log(recordset);-----> it successfully fetch 
the data 

                  *  res.set({ 'Content - Type': 'application/ms-excel; 
charset = UTF - 8' });*
*                      res.status(200).send(recordset);*
                  
                    connection.close();
                     
                         
                };
            });
        }
    });
    };


The recored set contains millions of record so if i convert it using npm 
json2xls it makes busy the browser and server to converting json into  xlsx 
.so this approach i don't want to use.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/25db43a3-601e-4423-bab9-13b429883252%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to