I'm very new to LLBLgen thing and am trying to convert the old insert sqlcommand code to llblgen method. I'm having a problem understanding how/which llblgen code to use for SELECT @@Indentity and ExecuteScalar call.
Part of the original code is something like this -
SqlCommand command = new SqlCommand("INSERT INTO tblABC (field1, field2, field3, field4l) VALUES (@Value1, @Value2, @Value3, @Value4)", connection);
command.Parameters.AddWithValue("@Value1", value1);
command.Parameters.AddWithValue("@Value2", value2);
command.Parameters.AddWithValue("@Value3", value3);
command.Parameters.AddWithValue("@Value4", value4);
command.ExecuteNonQuery();
command.CommandText = "SELECT @@IDENTITY";
_fieldID = command.ExecuteScalar().ToString();
connection.Close();
I've change the first part to the followings:
tblABCEntity myEntity = new tblABCEntity();
myEntity.field1 = value1;
myEntity.field2 = value2;
myEntity.field3 = value3;
myEntity.field4 = value4;
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.SaveEntity(myEntity);
}
And now I'm stuck at the second part conversion. I search through in the forum and found this post(http://llblgen.com/TinyForum/Messages.aspx?ThreadID=6801&HighLight=1) but not sure how exactly to utalize it in my code. I'm just completely lost here.
Any help plz?