ASP.NET 2.0 GridView / DetailsView and SqlDataProvider

ASP.NET 2.0 GridView / DetailsView and SqlDataProvider

Postby jvdb » Thu 04 Jan 2007 20:42

After inserting a order record in a DetailsView I want to send a confirmation mail. Therefore I need the inserted ID within the Item_Inserted event of the DetailsView. I searched the e.Values and the DataKey items, but I didn't find it.

What shall I do to get the Last_Insert_ID() within my DetailsView?

Best Regards
Joachim van de Bruck
Sunshine Solutions
jvdb
 
Posts: 2
Joined: Thu 04 Jan 2007 20:34

Postby Alexey » Fri 05 Jan 2007 13:38

What is meant by "SqlDataProvider"?
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby jvdb » Fri 05 Jan 2007 14:01

SqlDataProvider?

Oh, sorry. It's SqlDataSource, the standard System.Web.UI.WebControls.SqlDataSource.
jvdb
 
Posts: 2
Joined: Thu 04 Jan 2007 20:34

Postby Alexey » Fri 05 Jan 2007 15:58

Use Inserted event of the SqlDataSource component:
Code: Select all
int InsertedId = ((CoreLab.MySql.MySqlCommand)e.Command).InsertId;
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL