asp.net mvc - How can I create multiple new instances of a model and save them to the database? -


i'm using following code attempt import csv file. saving last object of fact rather saving each of objects built.

do while not sr.endofstream   dim afact fact   dim marray = sr.readline().split(",")    afact.name = marray(0)   afact.value = marray(1)   db.facts.add(afact)   end db.savechanges() 

just use list save object

dim factlist new list(of fact) ' add list while not sr.endofstream   dim afact fact   dim marray = sr.readline().split(",")    afact.name = marray(0)   afact.value = marray(1)   factlist.add(afact) ' put fact object in list   end 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -