0
我想将这些主键插入到我的其他表中,还是有其他简单的方法一次添加多个数据?数据库不受影响,作为回报,我得到的主键值为零
using(Dbcontext)
{
list<dbTable> dbTbl = new list<dbTbl>();
list<long> RetrunedPrimaryKeys = new list<long>();
for(int i=0; i<datafromPresentationlayer.count;i++)
{
dltable tbl = new dbtable();
tbl.name = datafromPresentationlayer[i].name;
tbl.address = datafromPresentationlayer[i].address
dbTbl.add(tbl);
}
Dbcontext.dbTable.InsertAllOnSubmit();
for(int i=0; i< datafromPresentationLayer.count;i++)
{
RetrunedPrimaryKeys.add(dbTbl[i].primarkeycolumn); // here i get all the primary keys as zero and in database there is not a single entry of these record
}
}
谢谢..我错过了.. – UnNamed