LinqDataSource. Get ID

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

How can I get the ID (primary key) of a record just inserted in a
database table by a LinqDataSource?

Thanks,
Miguel
 
Hello,

How can I get the ID (primary key) of a record just inserted in a
database table by a LinqDataSource?

Thanks,
Miguel

Handle the LinqDataSource's Inserted event and get the Result property
from the event args:

protected void MyLinqDataSource_Inserted(object sender,
LinqDataSourceStatusEventArgs e)
{
Whatever thing = (Whatever)e.Result;
//id is in: thing.<idcolumn>
}

-Michael Placentra II
 
Back
Top