Bugfix: Correctly return the new parent id that was inserted to the db.

This commit is contained in:
kougyokugentou 2020-04-30 09:21:21 -07:00
parent 50f266bf4d
commit 3d3e1bb0c3
1 changed files with 4 additions and 3 deletions

View File

@ -103,9 +103,10 @@ namespace DBWizard
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
{
string strQuery = "INSERT INTO PARENTS (FirstName,LastName,PhoneNumber,EmailAddress)" +
"VALUES (@FirstName,@LastName,@PhoneNumber,@EmailAddress);";
var affectedRow = cnn.Execute(strQuery, par);
return affectedRow;
"VALUES (@FirstName,@LastName,@PhoneNumber,@EmailAddress);" +
"SELECT MAX(parent_id) as parent_id from parents;";
int parent_id_out = cnn.Query<int>(strQuery, par).Single();
return parent_id_out;
}
}