ASP.NET 2.0 GridView / DetailsView and SqlDataProvider

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
jvdb
Posts: 2
Joined: Thu 04 Jan 2007 20:34

ASP.NET 2.0 GridView / DetailsView and SqlDataProvider

Post by 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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 05 Jan 2007 13:38

What is meant by "SqlDataProvider"?

jvdb
Posts: 2
Joined: Thu 04 Jan 2007 20:34

Post by jvdb » Fri 05 Jan 2007 14:01

SqlDataProvider?

Oh, sorry. It's SqlDataSource, the standard System.Web.UI.WebControls.SqlDataSource.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by 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;

Post Reply