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