Arvind Chourasiya

Arvind Chourasiya

  • NA
  • 933
  • 134.3k

How to insert multiple records at once in SQLite

Jul 21 2016 2:26 AM
Hii
i want to insert multiple record in my SQLite table at a time. See this line of code
var items = await MgoApi.Get("Assignment/GetAssigstudents", param);
in this line i'm getting multiple record in items from API, now how can i insert items all record in local database table.
i'm using xamarin android, SQLite database with SQLiteAsyncConnection in VS2013 :)
 
how i have tried see
  1. foreach(var _items in items)  
  2. {  
  3. obj.Amount = _items.Amount;  
  4. obj.Purpose_Of_Spending = _items.Purpose_Of_Spending;  
  5. obj.Type = _items.Type;  
  6. obj.Subject=_items.Subject;  
  7. obj.Rank=_items.Rank  
  8. var RowAffted= Repository_obj.Insert(obj);  
  9. }  
is this way is correct or not, if you people have more efficient way can suggest me. Thank You
 

Answers (2)