title: How to get the last row Id after insert data into table for SQLite
body: <p>I am using SQLite and SQLite-Net Wrapper for WinRT app. Other platform may have SQLite, but the implementation may be different such as using SQLite-Net api.</p>
  
  <p>How do I get the last row Id immediately after insert for SQLite? Thanks</p>
  
  <pre>
  
   using (var db = new SQLite.SQLiteConnection(DBPath))
              {
                  var newOrder = new SalesOrder()
                  {
                      CustId = g_intCustId,
                      Customer_No = txtBlkCustomer.Text.Trim(),
                      Order_Date = DateTime.Today                    
                  };
  
                  db.Insert(newOrder);
  
        }
  
  --1--- Update : I am using SQLite-Net Wrapper. I am not using SQLite -WInRT<br/>
  
  I get the following error :
  
  The type arguments for method 'SQLite.SQLiteConnection.ExecuteScalar(string, params object[])' <br/>
  cannot be inferred from the usage. Try specifying the type arguments explicitly.    
  
  db.Insert(newOrder);
  var key = db.ExecuteScalar("SELECT last_insert_rowid()");
  
  
  ---2-- Update <br/>
  
  This is the class :
  
  My problem is : How to get the SId immediately after inserting a record using above code.
  
   class SalesOrder
      {
          [PrimaryKey, AutoIncrement]
          public int SId { get; set; }  
  
          public int CustId { get; set; }
          public string Customer_No { get; set; }
          public DateTime  Order_Date { get; set; }
  
       }
  
  
  </pre>