User-1188570427 posted
Hi tvb2727,
From your description, I am a little confused. In which scene you need to do like this? I think it is more common do it in a controller action. If you want to initialize data, it's a better choice to do it with Seed
Data.
Best Regards,
Jiadong Meng
Hello,
Yes, so we are inserting data into the database as a new record. Part of the insert statement has a value that is from a different table. I need to query the database to pull that value in from the table somehow?
migrationBuilder.InsertData("Types", new string[] { "TypeId", "TypeName" }, new string[] { "6", "GridDefaultState" }, "dbo");
Above you see the "TypeId" is set directly to 6. But what if I needed to pull that "TypeId" from the database and set it as a variable?