V
Vik
How can I retrieve an Identity value after inserting a new row with an
SQLDataSource?
Thanks.
Victor
SQLDataSource?
Thanks.
Victor
Vik said:How can I retrieve an Identity value after inserting a new row with an
SQLDataSource?
Thanks.
Victor
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4068 (20090512) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
Eliyahu Goldin said:End your InsertCommand with ";set @NewId = scope_identity()".
Handle the SqldataSource Inserted event like this:
protected void myDataSource_Inserted(object sender,
SqlDataSourceStatusEventArgs e)
{
// get Id of the new record
this.newId = Convert.ToInt32(e.Command.Parameters["@NewId"].Value);
}
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
Vik said:How can I retrieve an Identity value after inserting a new row with an
SQLDataSource?
Thanks.
Victor
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4068 (20090512) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
Eliyahu Goldin said:End your InsertCommand with ";set @NewId = scope_identity()".
Handle the SqldataSource Inserted event like this:
protected void myDataSource_Inserted(object sender,
SqlDataSourceStatusEventArgs e)
{
// get Id of the new record
this.newId = Convert.ToInt32(e.Command.Parameters["@NewId"].Value);
}
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
Vik said:How can I retrieve an Identity value after inserting a new row with an
SQLDataSource?
Thanks.
Victor
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4068 (20090512) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com