title: Nodejs & Sqlite - Why each statement return no results
body: <p>I'm trying to retrieve the data from Sqilte DB (using NodeJs).
  I want to print into the log every row entry.
  For some reason I'm not getting errors but I'm not getting results either.</p>
  
  <p>I'm creating the DB in the following code:</p>
  
  <pre><code>var sqlite3 = require('sqlite3').verbose();
  
    var db = new sqlite3.Database('usersDataBase');
    db.run("CREATE TABLE IF NOT EXISTS usersTable (id INTEGER PRIMARY KEY AUTOINCREMENT , userName TEXT, password TEXT)");  
    db.close();
  </code></pre>
  
  <p>and adding users with the following code:</p>
  
  <pre><code> var db = new sqlite3.Database('usersDataBase');         
           var stmt = db.prepare("INSERT INTO usersTable VALUES (null, ?, ?)", userName, passw);       
           stmt.finalize();    
           db.close();
  </code></pre>
  
  <p>Finally I'm trying to print the table content with:</p>
  
  <pre><code>app.get("/view", function(req, res) {
  
  
      var db = new sqlite3.Database('usersDataBase');
      db.each("SELECT * FROM usersTable", function(err, row) {
          if (err) console.log('Error: ' + err);
          else console.log(row.userName + ": " + row.password)
         //db.close();
      });
      //db.close();
  
      // get to main screen
      console.log('Sending main.html')
      res.sendFile('main.html', {root: __dirname })
  })
  </code></pre>
  
  <p>But I'm getting nothing on the screen. (No error message and no results)</p>
  
  <p>What am I doing wrong ?</p>