So there is a handful of info on the net regarding how to access the last INSERT ID if you are using vb and sql or other products. cant find anything regarding my two products of choice. C# and MySql.
I have done this with PHP, but i do not know the command for it using C# asp.net.
Basically, i have a form that will submit into the db, but i have another INSERT statment that will run imediately following the first INSERT, but the catch is, i need to insert the row ID of INSERT statement 1 into INSERT statement 2.
using (SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]))
{
using (SqlCommand cmd = new SqlCommand(strQuery, con))
{
cmd.Connection.Open();
rint = (int)cmd.ExecuteScalar();
}
}
maybe, perhaps ado.net (think that’s what its called?) supports somehow but I really don’t know, you’d have to ask a .NET guy (and yes I know this is the .NET forum :))